Skip to content
Latchkey

GitHub Actions github-script "HttpError: Not Found" (404)

A github-script API call returns 404 "Not Found" because the parameters point at a resource that does not exist or is not visible to the token - often a wrong repo, a missing issue/PR number, or a private resource.

What this error means

The github-script step throws HttpError with status 404, usually from an API call whose owner/repo/number is wrong, or because the triggering event had no issue/PR so context.issue.number is undefined.

Actions log
RequestError [HttpError]: Not Found
    status: 404
# context.issue.number was undefined for this event, or the repo/owner is wrong

Common causes

Wrong or missing parameters

A 404 means the target does not exist for the token: a misspelled owner/repo, a number from the wrong context, or context.issue.number undefined because the event is not an issue/PR.

Resource not visible to the token

A private repo, package, or cross-repo resource the GITHUB_TOKEN cannot read returns 404 (GitHub hides existence) rather than 403.

How to fix it

Validate the parameters from context

Use context.repo for owner/repo and guard against a missing issue/PR number before calling.

.github/workflows/ci.yml
- uses: actions/github-script@v7
  with:
    script: |
      const num = context.issue.number;
      if (!num) { core.setFailed('No issue/PR in this event'); return; }
      await github.rest.issues.addLabels({ ...context.repo, issue_number: num, labels: ['triage'] });

Confirm access and existence

  1. Check the owner/repo spelling and that the resource exists.
  2. For cross-repo or private resources, supply a token with read access.
  3. Trigger the workflow on an event that actually has the issue/PR context you reference.

How to prevent it

  • Use context.repo and guard against undefined issue/PR numbers.
  • Supply a token that can read cross-repo or private resources.
  • Reference issue/PR context only on events that provide it.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →