Oauth error with stash

Drone produces the following intermittent error on the UI and the build immediately fails.

yaml: unmarshal errors: line 1: cannot unmarshal !!str `oauth_p...` into struct { Matrix map[string][]string }

We have Drone 0.8.4 communicating with stash 3.8.0.

At the moment the only workaround is to trigger another commit hook from stash as Drone fails to rerun the job from the UI.

Note that I don’t have any direct access to the stash server…

Any ideas?

Adding @josmo -
We are also facing similar issue with Drone v0.8.5 and Stash - 5.9
Here is the .drone.yml
image: maven:3.5.3-jdk-8
pull: true
- /var/run/docker.sock:/var/run/docker.sock
- git log | head -n 2
- mvn clean package

The root cause of this issue was because the user that activated the repository had their access revoked in Stash. As a result, when Drone tried to fetch the .drone.yml file for the repository, it returned an oauth error instead of a yaml file (hence the parsing error).

The solution is to use the drone repo chown command to re-assign ownership.

1 Like

Thanks for the posts guys. I was wondering if I was the only one with this error! :frowning:

Pretty sure we don’t have a revoke problem (another trigger can resolve), but it’s possible stash is slow to respond. Could that cause it?

I’ve also noticed this error is commonly hit when the branch match condition is not met.

So in the following in the .drone.yml …

branches: [ docker-*, refs/tags/* ]

…would not match a commit on an unrelated feature branch such as


In this case I’d expect Drone to just ignore it and mark the build as “NA” or something similar.

I recently helped one of our enterprise customers with this same issue, and they confirmed the error was a result of changed permissions. The user that activated the repository had their permissions revoked. They were able to resolve by disabling and re-enabling the repository (chown would work as well).

I do not have Stash, so I am not in a position to easily triage this, but would be happy to accept a pull request if you discover an issue. You can find the Stash driver here: https://github.com/drone/drone/tree/master/remote/bitbucketserver

Re-assigning the ownership resolved the issue in Bitbucket Stash - 5.9
Thanks @bradrydzewski