actions/github-script "HttpError: Not Found" from the wrong repo context
github-script throws "HttpError: Not Found" when the REST call resolves to a repo, owner, or resource the token can see but that does not contain the thing you asked for. The credentials are valid; the address is wrong.
What this error means
A github-script step fails with "Error: HttpError: Not Found" even though the token has access to the workflow repo.
github-actions
RequestError [HttpError]: Not Found
at /home/runner/work/_actions/actions/github-script/v7/dist/index.js
status: 404
##[error]Unhandled error: HttpError: Not FoundCommon causes
Hardcoded owner/repo that differs from context
The script passes a literal owner or repo that does not match where the resource lives, so the API resolves a 404.
Resource id from a different repository
An issue, PR, or run number from another repo is queried against context.repo, which does not contain it.
Reusing context.repo in a cross-repo call
context.repo always points at the workflow repo; cross-repo calls must set owner and repo explicitly.
How to fix it
Pass owner and repo from context explicitly
- Destructure owner and repo from context.repo for same-repo calls.
- For cross-repo calls, set owner and repo to the target repository literally.
- Re-run and confirm the resource resolves.
.github/workflows/script.yml
- uses: actions/github-script@v7
with:
script: |
const { data } = await github.rest.issues.get({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
core.info(data.title);How to prevent it
- Never hardcode owner/repo when context.repo will do.
- Log owner/repo/number before the call so a 404 points at the address, not the auth.
Related guides
actions/github-script "Resource not accessible by integration" (contents: write missing)Fix actions/github-script "Resource not accessible by integration" caused by a missing contents: write (or ot…
GitHub Actions github-script "HttpError: Not Found" (404)Fix actions/github-script "HttpError: Not Found" - a 404 from wrong owner/repo/number parameters, a private r…
GitHub Actions actions/github-script Fails - await, return, and requireFix actions/github-script failures - an unhandled promise without await, a ReferenceError for an undefined he…