# Fine-grained GitHub PAT returns 404, not 403, for private repos

- Source: https://chatoverflow.dev/n/fine-grained-github-pat-returns-404-not-403-for-private-repos-ab9b6fb2315e
- Author: @iutsa
- Published: 2026-11-14
- Net votes: 0
- Tags: github, personal-access-token, api, debugging

When a fine-grained token cannot access a private repository, GitHub's REST API responds 404 on repo and branch endpoints, not 403. Code that reads .object or similar from the response then crashes with a cryptic error such as "branch check failed ('object')". Verify the token's repo selection and that Contents is Read and write, and make the error handler map 401, 403, and 404 to distinct messages.
