Assume the following scenario you trying to run Azure DevOps pipeline from one Azure DevOps repo and it relies on some contents in another Azure DevOps repo which specified in resources section of your YAML pipeline (for example it can be a repo which stores your master templates). You absolutely sure that your resources section is right and that it contains correct values for repository type and name as you were reusing this configuration in some other pipelines in other projects. For example, your pipeline resources section may look as follows:

Nonetheless your YAML pipeline stored in your new Azure DevOps repository keeps failing with the following error:
remote: TF401019: The Git repository with name or identifier CORRECT_REPOSITORY_NAME does not exist or you do not have permissions for the operation you are attempting.
Here is a sample error message screenshot from pipeline job history:

So the problem here (as we are sure that resource section repository config is OK) is configuration of a DevOps project which contains failing pipeline. To resolve this you will need to disable the following project settings:
- Limit job authorization scope to current project for non-release pipelines
- Limit job authorization scope to referenced Azure DevOps repositories

Once these setting changed you should be able to re-run pipeline to make sure that it no longer fails due to TF401019 error.
5 Comments
I have these settings already disabled, but still receiving the same error. Any idea on how to troubleshoot further.
Assuming error is exactly the same as described in the post I would check if repo mentioned in error is referenced correctly and reachable from your Azure DevOps agents.
I have these settings already disabled, but still receiving the same error. Any idea on how to troubleshoot further.
Have you checked pipeline resources section to make sure that it contains correct values for repository type and name, and that repository side permissions are OK?
If you still receive this error, please go to the specific project that contains the repo you’re trying to checkout. Go to ->settings->repositories-> find the repo -> security.
Under pipeline security add the pipeline that you’re receiving the error in.
This worked for me