Fix For: ‘The pipeline is not valid error: Unable to resolve latest version’ on an Azure DevOps YAML pipeline

The Issue

I have an Azure DevOps multi-stage YAML pipeline that started giving the error `The pipeline is not valid error: Unable to resolve latest version for pipeline templates: this could be due to inaccessible pipeline or no version is available` and failing instantly.

image

The Solution

This is not the most helpful message, but after some digging I found the problem.

The pipeline used another pipeline as a resources

1resources:   
2  pipelines:  
3  - pipeline: templates  
4    source: QueuesAndFunctionsDemo-CI    
5    branch: master

This referenced build had failed, so there was no successful build resources to load, hence the error.

Once the problem with this reference build was fixed the error message went away and I could trigger my build