GitLab is throwing the error
Unable to locate credentials when running a pipeline job and the variables are protected.
The most likely reason for this is that if the variables are protected then they can only be accessed by a protected branch or tag.
And if the branch is protected but the tag isn’t protected then GitLab will throw the error.
So ensure that the the branch and the tags are protected.
This can be done in:
Settings > Repository > Protected Branches / Protected Tags
To protect all tags by default, the wildcard
* can be used: