{"record":{"id":"dfa74ea2db867dd1","repo":"tiangolo/fastapi","slug":"response-text","errorCode":null,"errorMessage":"response.text","messagePattern":"response\\.text","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"scripts/notify_translations.py","lineNumber":229,"sourceCode":"        \"after\": after,\n        \"category_id\": category_id,\n        \"discussion_number\": discussion_number,\n        \"discussion_id\": discussion_id,\n        \"comment_id\": comment_id,\n        \"body\": body,\n    }\n    response = httpx.post(\n        github_graphql_url,\n        headers=headers,\n        timeout=settings.httpx_timeout,\n        json={\"query\": query, \"variables\": variables, \"operationName\": \"Q\"},\n    )\n    if response.status_code != 200:\n        logging.error(\n            f\"Response was not 200, after: {after}, category_id: {category_id}\"\n        )\n        logging.error(response.text)\n        raise RuntimeError(response.text)\n    data = response.json()\n    if \"errors\" in data:\n        logging.error(f\"Errors in response, after: {after}, category_id: {category_id}\")\n        logging.error(data[\"errors\"])\n        logging.error(response.text)\n        raise RuntimeError(response.text)\n    return cast(dict[str, Any], data)\n\n\ndef get_graphql_translation_discussions(\n    *, settings: Settings\n) -> list[AllDiscussionsDiscussionNode]:\n    data = get_graphql_response(\n        settings=settings,\n        query=all_discussions_query,\n        category_id=questions_translations_category_id,\n    )\n    graphql_response = AllDiscussionsResponse.model_validate(data)","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/tiangolo/fastapi/blob/3e8d1526d83a90aaf7d6eb6dc682bf150f180b25/scripts/notify_translations.py#L211-L247","documentation":"Raised by get_graphql_response() in scripts/notify_translations.py:229 when a GitHub GraphQL request returns a non-200 HTTP status. The body text (response.text) is used as the RuntimeError message so the GitHub API error is surfaced verbatim. This path covers transport/auth failures distinct from GraphQL-level errors (which are handled at line 235).","triggerScenarios":"notify_translations.main() issues GraphQL POSTs via httpx to https://api.github.com/graphql (scripts/notify_translations.py:218). Any response.status_code != 200 raises here — common causes: 401 invalid/expired token, 403 rate limit or scope, 5xx GitHub outage, network proxy returning non-200.","commonSituations":"GITHUB_TOKEN is expired, revoked, or lacks repo/discussion scope. Secondary rate limit hit during a burst of CI runs. GitHub incident. A corporate proxy intercepts the request.","solutions":["Check the response body in the log line emitted just before the raise (scripts/notify_translations.py:228 logs response.text at ERROR).","Refresh GITHUB_TOKEN / the GitHub App token and confirm it has repo + discussions read scope.","If the body mentions 'rate limit', wait and retry; consider exponential backoff.","For 5xx, retry after a short delay; consult https://www.githubstatus.com/."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"import os\n\ndef github_token_present() -> bool:\n    return bool(os.environ.get(\"GITHUB_TOKEN\"))","typeGuard":null,"tryCatchPattern":"import time, httpx, logging\n\nfor attempt in range(4):\n    try:\n        data = get_graphql_response(settings=settings, query=q)\n        break\n    except RuntimeError as e:\n        if attempt == 3:\n            raise\n        logging.warning(f\"GraphQL HTTP error, retrying: {e}\")\n        time.sleep(2 ** attempt)","preventionTips":["Inject a fresh, scoped GITHUB_TOKEN per job; do not cache long-lived tokens in CI.","Implement exponential backoff on 401/403/5xx for GraphQL calls.","Log response.status_code alongside response.text to triage quickly."],"tags":["network","github","graphql","ci"],"backgroundTag":null,"analyzedSha":"3e8d1526d83a90aaf7d6eb6dc682bf150f180b25","analyzedAt":"2026-08-11T02:34:52.986Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}