Azure Pipelines "Template file could not be found"
Azure DevOps could not resolve a referenced template file, so the pipeline failed to compile before any job ran.
What this error means
Validation fails with "Template file X could not be found" naming the path. The pipeline does not start because templates are merged at compile time.
azure-pipelines
Template file 'templates/build.yml' could not be found.Common causes
Wrong relative path
The template path does not match the file location relative to the referencing file.
Missing repository resource
A template in another repo is referenced without declaring that repository resource.
Branch or ref mismatch
The template exists on a different branch than the one used to resolve it.
How to fix it
Correct the path and resource
- Verify the template path relative to the file that includes it.
- Declare a repositories resource and use @resource for cross-repo templates.
azure-pipelines.yml
resources:
repositories:
- repository: templates
type: git
name: org/templates
steps:
- template: build.yml@templatesHow to prevent it
- Keep template paths relative and declare repository resources explicitly; this is a path/config issue, not a transient one.
Related guides
Azure Pipelines YAML Schema Validation ErrorFix the Azure Pipelines "azure-pipelines.yml schema validation" error where the YAML uses an unknown property…
Azure Pipelines "Unrecognized value" Variable ReferenceFix the Azure Pipelines "Unrecognized value" error where a variable or expression token is not recognized at…
Azure Pipelines "dependsOn" Stage or Job Not FoundFix the Azure Pipelines error where a stage or job dependsOn references a name that does not exist, breaking…