Skip to content

GraphQL return "RATE_LIMIT" and not "RATE_LIMITED" when you reach the rate limit #824

@jarenere

Description

@jarenere

Hi,

I'm using the GitHubKit library, and the client is based on OctoKit. I've noticed that when the rate limit is reached in GraqhQL, the error returned is RATE_LIMIT instead of RATE_LIMITED.

Your client expects the string RATE_LIMITED

(error: any) => error.type === "RATE_LIMITED",

I've attached a couple of traces with different queries in GraphQL.

Request/Response migration query

Request Headers: {'host': 'api.github.com', 'accept-encoding': 'gzip, deflate', 'connection': 'keep-alive', 'user-agent': 'GitHubKit/Python', 'accept': 'application/vnd.github+json', 'content-length': '429', 'content-type': 'application/json', 'authorization': 'token xxxx'}
Request Body: b'{"query":"\\nquery($id: ID!) { \\n    node(id: $id) {\\n        ... on Migration {\\n            id,\\n            sourceUrl,\\n            migrationLogUrl,\\n            migrationSource {\\n                name\\n            },\\n            state,\\n            warningsCount,\\n            failureReason,\\n            repositoryName\\n        }\\n    } \\n}\\n","variables":{"id":"yyyy"}}'
Response Headers: {'date': 'Thu, 08 Jan 2026 16:49:49 GMT', 'content-type': 'application/json; charset=utf-8', 'x-oauth-scopes': 'admin:org, repo, workflow', 'x-accepted-oauth-scopes': 'repo', 'x-github-media-type': 'github.v4; format=json', 'x-ratelimit-limit': '5000', 'x-ratelimit-remaining': '0', 'x-ratelimit-reset': '1767892233', 'x-ratelimit-used': '5018', 'x-ratelimit-resource': 'graphql', 'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset', 'access-control-allow-origin': '*', 'strict-transport-security': 'max-age=31536000; includeSubdomains; preload', 'x-frame-options': 'deny', 'x-content-type-options': 'nosniff', 'x-xss-protection': '0', 'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin', 'content-security-policy': "default-src 'none'", 'vary': 'Accept-Encoding, Accept, X-Requested-With', 'content-encoding': 'gzip', 'transfer-encoding': 'chunked', 'server': 'github.com', 'x-github-request-id': '4C25:1F1B3F:2B04832:26C1653:695FE02C'}
Response Body: {"errors":[{"type":"RATE_LIMIT","code":"graphql_rate_limit","message":"API rate limit already exceeded for user ID zzzzz."}]}

Request/Response list repo query

Request Headers: {'host': 'api.github.com', 'accept-encoding': 'gzip, deflate', 'connection': 'keep-alive', 'user-agent': 'GitHubKit/Python', 'accept': 'application/vnd.github+json', 'content-length': '163', 'content-type': 'application/json', 'authorization': 'token xxxx'}
Request Body: b'{"query":"\\nquery ($owner: String!, $repo: String!) {\\n  repository(owner: $owner, name: $repo) {\\n    name\\n  }\\n}\\n","variables":{"owner":"owner","repo":"repo"}}'
Response Headers: {'date': 'Thu, 08 Jan 2026 17:21:18 GMT', 'content-type': 'application/json; charset=utf-8', 'x-oauth-scopes': 'admin:org, repo, workflow', 'x-accepted-oauth-scopes': 'repo', 'x-github-media-type': 'github.v4; format=json', 'x-ratelimit-limit': '5000', 'x-ratelimit-remaining': '0', 'x-ratelimit-reset': '1767896168', 'x-ratelimit-used': '5002', 'x-ratelimit-resource': 'graphql', 'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset', 'access-control-allow-origin': '*', 'strict-transport-security': 'max-age=31536000; includeSubdomains; preload', 'x-frame-options': 'deny', 'x-content-type-options': 'nosniff', 'x-xss-protection': '0', 'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin', 'content-security-policy': "default-src 'none'", 'vary': 'Accept-Encoding, Accept, X-Requested-With', 'content-encoding': 'gzip', 'transfer-encoding': 'chunked', 'server': 'github.com', 'x-github-request-id': '6042:18034E:2DBF8B5:29287C7:695FE78E'}
Response Body: {"errors":[{"type":"RATE_LIMIT","code":"graphql_rate_limit","message":"API rate limit already exceeded for user ID xxxx."}]}

Regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions