Skip to content
Latchkey

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

  1. Verify the template path relative to the file that includes it.
  2. 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@templates

How to prevent it

  • Keep template paths relative and declare repository resources explicitly; this is a path/config issue, not a transient one.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →