{"record":{"id":"e1d9f3984cb93ed7","repo":"iflytek/astron-agent","slug":"response-code-is-response-status","errorCode":null,"errorMessage":"response code is {response.status}","messagePattern":"response code is (.+?)","errorType":"exception","errorClass":"AppAuthFailedExc","httpStatus":null,"severity":"error","filePath":"core/agent/infra/app_auth.py","lineNumber":161,"sourceCode":"        }\n        return headers\n\n    async def app_detail(self, app_id: str) -> Optional[Dict[str, Any]]:\n        headers = self.init_header(\"\")\n        async with aiohttp.ClientSession() as session:\n            timeout = aiohttp.ClientTimeout(total=3)\n            async with session.get(\n                self.config.url,\n                params={\"app_ids\": app_id + \",\"},\n                headers=headers,\n                timeout=timeout,\n            ) as response:\n                response.raise_for_status()\n                if response.status == 200:\n                    result = await response.json()\n                    return dict(result)\n\n                raise AppAuthFailedExc(\"response code is {response.status}\")\n\n\nclass MaasAuth(BaseModel):\n    app_id: str\n    model_name: str\n\n    app_id_not_found_msg: str = Field(\n        default=\"Cannot find appid authentication information\"\n    )\n\n    async def sk(self, span: Span) -> str:\n        with span.start(\"QueryAppIdSk\") as sp:\n            app_detail = await APPAuth().app_detail(self.app_id)\n\n            sp.add_info_events(\n                {\n                    \"kong-app-detail\": json.dumps(\n                        {","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/agent/infra/app_auth.py#L143-L179","documentation":"AppAuthFailedExc raised in app_detail when the auth service responds with a status other than 200. Note the literal string 'response code is {response.status}' is missing the f-prefix, so the actual status code is not interpolated — the developer always sees the placeholder text.","triggerScenarios":"Calling the app-auth detail lookup when the remote auth service returns 4xx/5xx (after raise_for_status passes or for non-200 success-range codes), e.g. app not found, auth service error, or wrong app_id.","commonSituations":"Misconfigured auth service URL; invalid/expired service credentials; auth service outage returning 500; querying a deleted or wrong-space app_id.","solutions":["Fix the missing f-prefix in the raise so the real status is logged: f\"response code is {response.status}\"","Check the auth service URL and credentials in configuration","Verify the app_id exists and is accessible from this space","Check auth service health/logs for the non-200 response cause"],"exampleFix":"# before\nraise AppAuthFailedExc(\"response code is {response.status}\")\n\n# after\nraise AppAuthFailedExc(f\"response code is {response.status}\")","handlingStrategy":"try-catch","validationCode":"r = requests.get(auth_url, timeout=10)\nif r.status_code != 200:\n    logger.warning(\"app detail returned %s\", r.status_code)","typeGuard":null,"tryCatchPattern":"try:\n    detail = await auth.app_detail(app_id)\nexcept AppAuthFailedExc as e:\n    logger.error(\"app auth failed: %s\", e)\n    return None","preventionTips":["Fix the missing f-prefix so real status codes are visible","Monitor auth service health and non-200 rates","Validate app_id configuration before calling auth lookups"],"tags":["http","auth-service","fstring-bug"],"backgroundTag":"http-error-response","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}