Azure Pipelines: /azure-pipelines.yml: File /templates/build.yml not found in repository / Unable to find template
The YAML references a template (template: templates/build.yml) that Azure cannot find — wrong path, repo resource or branch.
File not found in repository templateUnable to find template Azure Pipelines/azure-pipelines.yml: File /templates/build.yml not found in repositoryA template expression is not allowed in this context Meaning
Template paths are relative to the file that references them, unless they start with / (repo root). Templates in other repositories need a resources: repositories: entry and @alias. The branch the pipeline runs on must contain the file.
Common causes
- Relative path wrong from the current file
- Leading
/used but file is elsewhere - Repository resource not declared or wrong
ref - File exists on a different branch only
- Typo in file name or case on Linux agents
⚡ Quick fix
- Fix the path relative to the current file or use
/from repo root - Declare
resources.repositoriesand usetemplate: file.yml@alias - Commit the template to the branch being built
Detailed fix by platform
Azure DevOps
- Reference:
- template: templates/build.yml@sharedafterresources: repositories: - repository: shared; type: git; name: Project/shared-repo
Code examples
Template from another repo
resources:
repositories:
- repository: shared
type: git
name: MyProject/shared-templates
steps:
- template: build.yml@sharedHow to diagnose
- Path — Relative or from root?
- Repo — Resource declared?
- Branch — File exists on this branch?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- .gitlab-ci.yml invalid GitLab CI: Found errors in your .gitlab-ci.yml: jobs:build config contains unknown keys: scripts
- Cannot find orb CircleCI: Cannot find orb 'circleci/node@9.9.9'. Check the namespace and version exist
- ComparisonError: manifest generation failed Argo CD: ComparisonError: rpc error: code = Unknown desc = Manifest generation error (cached): kustomize build failed
Most viewed in CI/CD
- The process '/usr/bin/git' failed with exit code 128 GitHub Actions: Error: The process '/usr/bin/git' failed with exit code 128
- This job is stuck because you don't have any active runners GitLab CI: This job is stuck because you don't have any active runners online or available with any of these tags assigned to them
- Resource not accessible by integration GitHub Actions: Error: Resource not accessible by integration (403)
Other ways to find it
Where this error sits
Origin: Build & delivery. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 25 Oct 2026