Error cannot find yaml

When Drone receives a webhook from your source control manage system (e.g. GitHub) it attempts to retrieve the Yaml. This thread will discuss potential root causes for failure to retrieve the Yaml, which can be identified by the following entry in your server logs:

{"error":"Not Found","msg":"trigger: cannot find yaml","ref":"refs/pull/1266/head","event":"pull_request","level":"warning"}

Missing Yaml

The most common root cause for this error is a missing Yaml. A common misconception is that Drone only fetches the Yaml from the default (master) branch. This is not the case. Drone fetches the Yaml using the head commit sha associated with the push / pull request / tag.

Example

You add a .drone.yml to your master branch. You have a feature branch named development that does not have a .drone.yml. You create a pull request where development is the source branch and master is the target branch. Drone will attempt to fetch the Yaml from development, not from master. This will result in an error because the Yaml does not exist in the source branch.

Solution

All branches and pull requests must have the Yaml file in the commit being tested. This means if you have existing branches and pull requests prior to activating Drone, and then you activate Drone, you need to proactively add the Yaml to these existing branches and pull requests.

Wrong Yaml Name

This is a common root cause where there is a simple typo or incorrect file name. Below are some common problems to look out for.

Incorrect file extension:

-.drone.yaml
+.drone.yml

Missing dot prefix:

-drone.yml
+.drone.yml

Repository Permissions Revoked

Drone makes API calls to fetch the Yaml on behalf of the user that activated the repository. If this user’s access to the repository is revoked (they leave the organization, etc) then subsequent API calls made on behalf of the user will fail.

Example

User janecitizen activates a repository named acme/hello-world. Later, janecitizen leaves the company and no longer has access to acme/hello-world. Drone will no longer be able to fetch the yaml for acme/hello-world because janecitizen had their access revoked.

Solution

The solution is to have another user de-activate and re-activate the repository in Drone. Then, going forward, Drone will make API calls on behalf of this other user.

Drone Permissions Revoked

Drone makes API calls to fetch the Yaml on behalf of the user that activated the repository. If this user revokes Drone’s access, subsequent API calls made on behalf of the user will fail.

Example

User janecitizen authorizes Drone access to their GitHub account during the Drone login process. The user activates a repository named acme/hello-world. Later, user janecitizen revokes Drone’s access to their GitHub account in their GitHub account settings screen. Drone will no longer be able to fetch the yaml for acme/hello-world because janecitizen revokes Drone’s access.

Solution

The solution is to have another user de-activate and re-activate the repository in Drone. Then, going forward, Drone will make API calls on behalf of this other user.