No commit found for the ref agent-facts-no-such-ref
GitHub REST API · GET /repos/{owner}/{repo}/contents/{path} · HTTP 404
Status: ✅ verified:server:prod · first seen 2026-10-31 · last confirmed 2026-10-31 · 1 confirmation from 1 vantage
GET /repos/{owner}/{repo}/contents/{path}?ref=<ref> with a ref that names no branch, tag or commit returns HTTP 404 "No commit found for the ref <ref>", even when the path exists on the default branch.
What to do
- No client-side fix known (by design).
Example
What probe af:github:probe:contents-unknown-ref sends (prod) and what it checks in the answer.
GET https://api.github.com/repos/octocat/Hello-World/contents/README?ref=agent-facts-no-such-ref
Response (only what the probe asserts; other fields omitted):
HTTP 404
{
"message": "No commit found for the ref agent-facts-no-such-ref"
}
In your code
When an SDK receives this response:
| SDK | Raises | Check |
|---|---|---|
Python PyGithub (community) |
github.GithubException |
e.status == 404 |
Node @octokit/request |
RequestError |
err.status === 404 |
Read from the SDK source: PyGithub 2.10.0: github/Requester.py Requester.createException; @octokit/request 10.0.16: dist-bundle/index.js fetchWrapper; @octokit/request-error 7.1.2.
Dimensions
env: prod · plan: any · region: any · account_state: anonymous
Evidence
Probe af:github:probe:contents-unknown-ref (declarative, source)
Observations: none from reporters yet.
Related errors
Not Found· GET /repos/{owner}/{repo}/contents/{path} · HTTP 404Not Found· GET /repos/{owner}/{repo}/contents/{dir}/{path} · HTTP 404Not Found· GET /repos/{owner}/{repo}/contents/{dir}/{subdir}/{path} · HTTP 404Not Found· GET /repos/{owner}/{repo}/contents/{dir}/{subdir}/{subdir2}/{path} · HTTP 404- REST error bodies carry a status field holding the HTTP code as a JSON string, such as "404", not as a number. · GET /repos/{owner}/{repo} · HTTP 404
Not Found· GET /repos/{owner}/{repo} · HTTP 404
Machine access
Match signature (what check() matches): no commit found for the ref agent-facts-no-such-ref
curl -s https://apifacts.dev/v0/check \
-H 'content-type: application/json' \
-d '{"target":{"method":"GET","url":"https://api.github.com/repos/{owner}/{repo}/contents/{path}"},"error":{"status":404,"body_excerpt":"no commit found for the ref agent-facts-no-such-ref"}}'
YAML: facts/github/contents-unknown-ref-404.yaml
Data: CC BY 4.0 · apifacts registry · This page is generated; edit the YAML, not the page.