Skip to main content

Errors and Status Codes

This section aims to list and explain common errors and status codes within this project's scope of issues.

warning

The GitHub API intentionally uses ambiguous status codes (403 and 404) to avoid leaking information about private resources.


Global Status Codes

All Status Codes

This is a global list of all common status codes relevant for this project. While there may be more, they are rare or irrelevant for the scope.

This list is sorted by numerical order

Status CodeNameContext / When It HappensObserved BehaviorClient Action
200OKSuccessful requestReturns array of issues. If page is out of range, returns empty array [].Process response normally. Stop pagination if empty.
304Not ModifiedConditional request using If-None-Match or If-Modified-Since.No response body. Does not consume rate limit credits.Use cached data. Do not retry immediately.
400Bad RequestInvalid query parameters or malformed request.Error message returned in JSON body.Fix request parameters. Retry only after correction.
401UnauthorizedMissing or invalid authentication token.Returns error message indicating authentication failure.Provide valid PAT. Retry only after fixing auth.
403ForbiddenPrimary rate limit exceeded or insufficient permissions.Can indicate rate limit or access restriction. Check headers.Inspect x-ratelimit-remaining. Wait or adjust permissions.
404Not FoundRepository does not exist or user lacks access.Same response for both cases. No permission distinction.Verify repo existence and permissions. Do not retry blindly.
422Unprocessable EntityValid request but semantically invalid parameters.Returns detailed validation errors in response body.Fix input values. Retry after correction.
429Too Many RequestsSecondary rate limit triggered (burst traffic).Temporary block. May include Retry-After header.Back off. Retry after delay. Avoid concurrent bursts.
500Internal Server ErrorGitHub server error.Rare. No client fault.Retry with exponential backoff.
502Bad GatewayUpstream GitHub issue.Temporary infrastructure failure.Retry after short delay.
503Service UnavailableGitHub service temporarily unavailable.Often short-lived outages.Retry later. Respect backoff.

Contextual Errors

This section lists status codes split into different tabs for each particular issue to make navigation easier and to list issues for each point individually.

CodeScenarioDeep DiveCorrective Action
404Repository AccessOccurs if the {owner} or {repo} in the URL is misspelled, or if you are trying to access a private repo with a token that lacks the repo scope.Double-check the URL slug and verify your Token scopes.
422Invalid FiltersTriggered when parameters like since are not in ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ) or when invalid labels are provided.Ensure all filter values strictly follow the GitHub API data types.
200Empty ResultsNot an error, but happens when your filters (labels, state, etc.) are so restrictive that no issues match the criteria.Try broadening your search filters to verify connectivity.

When Does Retry Make Sense?

When making requests, you run into an error. Sometimes, it's valid to simply try the same request again. However, avoid retrying excessively.

note

Not all codes should be retried

Status CodeRetry?Notes
400Fix request before retrying
401Authentication issue.
403⚠️Retry only if rate-limited.
429Retry after delay.
5xxRetry with backoff.

Request Errors

If you make a bad request or run into issues with a particular request, the JSON may return an error.

These JSON responses usually contain a readable message and a documentation reference.


Practical Error Example

Use these exact requests as a point of reference for the error 401 Unauthorized.

Use an invalid or expired token, or copy this as is to reproduce this error.

curl -i -H "Authorization: Bearer <TOKEN>" "https://api.github.com/repos/facebook/react/issues?per_page=1&page=1"

JSON Error Response Example:

{
"message": "Bad credentials",
"documentation_url": "https://docs.github.com/rest",
"status": "401"
}
note

This 401 Unauthorized bad credentials error happened because the token is invalid. If you simply copy paste the code without changing the <TOKEN> for a valid one, the request returns an error.

It also happens if you mistype your key or use an expired one.