Lesstep
Azure Pipelines · YAML · Checked November 9, 2026

Azure Pipelines: "File /templates/build.yml not found in repository"

Azure Pipelines reads the pipeline's YAML file and every template from the repository when the run is created, before any job or checkout. When a file is not where it looks, the run does not start, and the message says exactly where it looked: the full path, the repository and the branch. Put that next to where the file really is, and the cause is usually one of the cases below.

What it looks like

File azure-pipelines.yml not found in repository contoso/web-app at version/branch feature/login.
/pipelines/deploy.yml: File /pipelines/templates/build.yml not found in repository https://dev.azure.com/contoso/WebApp/_git/WebApp branch refs/heads/feature/login version 5b1e0c9a7f3d2e8b4c6a1f0e9d8c7b6a5f4e3d2c

When the pipeline is a pull request's build validation, the pull request waits on it: Azure DevOps Pull Requests, a plugin for JetBrains IDEs, lists the pull request's branch policies with their state in IntelliJ IDEA, Rider or PyCharm, and with Pro runs a failed build policy again once the YAML is fixed. Its Pipelines tab (version 1.0.86 and later) lists the runs of the repositories you have open and opens a failed task's log in the editor, free to read.

The pipeline's own YAML file

A template path is relative to the file that includes it

Microsoft's page on templates: a template path that starts with / is absolute within the repository; every other path is relative to the file that does the including, not to the repository root and not to the main pipeline file.

# /pipelines/deploy.yml
steps:
- template: templates/build.yml     # looks for /pipelines/templates/build.yml
- template: /templates/build.yml    # looks for /templates/build.yml
- template: ../templates/build.yml  # also /templates/build.yml

The path after File in the message is the one it built, so a folder that appears twice or in the wrong place shows at once. Starting every template path with / avoids the question for files in the same repository.

A template in another repository

resources:
  repositories:
  - repository: templates            # the alias after @
    type: git
    name: Platform/BuildTemplates    # project/repository
    ref: refs/heads/master
steps:
- template: build.yml@templates      # path inside that repository, without its name

Inside an extends template from another repository

A pipeline that extends a template in a central repository runs that template's template: lines in the central repository, relative to the template's file. A file from the pipeline's own repository needs @self, which the templates page describes for this case:

- template: /templates/localized-build.yml@self

A variable in the template path

- template: $(TEMPLATE_FILE) looks for a file whose name is the text $(TEMPLATE_FILE), because templates are expanded before $() is replaced. Use a parameter or a variable written in the YAML with ${{ variables.TEMPLATE_FILE }}; the same timing is behind "is not a valid Boolean".

Azure DevOps pull requests in IntelliJ IDEA, Rider and PyCharm

Azure DevOps Pull Requests, a plugin by Lesstep for JetBrains IDEs 2024.1 or later and Android Studio, reads the organization, project and repository from your git remote and lists the pull requests that wait for your review in an IDE tool window, on Azure DevOps Services and on Azure DevOps Server. It shows the branch policies of a pull request with their state, so a required build that has not passed is next to its pull request, and with Pro you run a failed or expired build policy again from there. The review inbox is free; voting, commenting, completing and creating are Pro, with a 30-day trial.

Get it on JetBrains Marketplace

Azure DevOps and Azure Pipelines are trademarks of Microsoft Corporation; IntelliJ IDEA, Rider and PyCharm are trademarks of JetBrains s.r.o. This page is not affiliated with or endorsed by Microsoft or JetBrains.

More: Unexpected value 'variables', 'stages' or 'steps' · A template expression is not allowed in this context · The 'name' parameter value '$(VAR)' is not a valid Boolean · Build validation · 日本語