GitHub package registry: cannot find package version with version id, please ensure that your token has repo scopes

I've been trying to move my images project by project from my own Docker registry to the GitHub package registry. But when I started on the second project I quickly ran into the following error: name unknown: Request failed with: Cannot find package version with version id '161877', please ensure that your token has 'repo', 'read:packages' & 'write:packages' scopes 🤔.

After digging around a bit I came to the conclusion that apparently the image name is unique on a user level, and not on repository level. Basically both docker.pkg.github.com/wouterds/wouterdeschuyter.be/nginx and docker.pkg.github.com/wouterds/ikhaat.be/nginx will resolve to the same image. You could think of it as if they both point to docker.pkg.github.com/wouterds/nginx, as displayed on your profile.

Currently a workaround could be giving your image names a prefix/suffix with the repository name. But the full tag looks a bit odd though (e.g. docker.pkg.github.com/wouterds/ikhaat.be/beikhaat-nginx). I'm not sure if this is a feature or a bug, but I reached out to GitHub on Twitter for a comment and will update this post if they get back to me, or if anything changes in this behaviour in the future.