{"record":{"id":"1968077c2dc49f27","repo":"iflytek/astron-agent","slug":"knowledge-request-error-pro-node-response-status-response","errorCode":"KNOWLEDGE_REQUEST_ERROR","errorMessage":"Knowledge Pro node response status: {response.status}","messagePattern":"Knowledge Pro node response status: (.+?)","errorType":"http","errorClass":"CustomException","httpStatus":null,"severity":"error","filePath":"core/workflow/engine/nodes/knowledge_pro/knowledge_pro_node.py","lineNumber":148,"sourceCode":"            # Get the Knowledge Pro API endpoint URL from environment or use default\n            url = f\"{os.getenv('KNOWLEDGE_PRO_BASE_URL')}/knowledge/v1/agent/achat\"\n\n            # Validate CBG RAG parameters before proceeding\n            await self._check_cbg_rag_param()\n\n            # Generate request payload for the Knowledge Pro API\n            payload = self.gen_req_payload(query, span)\n            await span.add_info_event_async(f\"request body: {payload}\")\n            # Create HTTP session with appropriate timeout configuration\n            async with aiohttp.ClientSession(\n                timeout=ClientTimeout(\n                    total=30 * 60, sock_connect=30, sock_read=interval_timeout\n                )\n            ) as session:\n                # Send POST request to Knowledge Pro API\n                async with session.post(url=url, json=payload) as response:\n                    if response.status != httpx.codes.OK:\n                        raise CustomException(\n                            err_code=CodeEnum.KNOWLEDGE_REQUEST_ERROR,\n                            cause_error=f\"Knowledge Pro node response status: {response.status}\",\n                        )\n\n                    content_list, knowledge_metadata, token_usage = (\n                        await self._handle_response(\n                            response, span, variable_pool, msg_or_end_node_deps\n                        )\n                    )\n\n            # Prepare final outputs with combined content and metadata\n            outputs = {\"output\": \"\".join(content_list), \"result\": knowledge_metadata}\n        except asyncio.TimeoutError:\n            # Handle timeout errors during API request\n            log_err = CustomException(\n                err_code=CodeEnum.KNOWLEDGE_REQUEST_ERROR,\n                err_msg=f\"Knowledge Pro node response timeout ({interval_timeout}s)\",\n            )","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/workflow/engine/nodes/knowledge_pro/knowledge_pro_node.py#L130-L166","documentation":"After posting to the Knowledge Pro API, the node checks the HTTP status; any status other than 200 (httpx.codes.OK) raises a CustomException with KNOWLEDGE_REQUEST_ERROR whose cause includes the status code. It means the Knowledge Pro service rejected or failed the request at the HTTP level.","triggerScenarios":"The async aiohttp/httpx POST to the Knowledge Pro retrieval API returns e.g. 401, 404, 500, or 502 instead of 200; auth token invalid, URL wrong, or the knowledge service crashing.","commonSituations":"Knowledge Pro service is down or restarting in the cluster; API base URL configured incorrectly in node settings; expired credentials rejected with 401; gateway returning 502/504 under load.","solutions":["Check the Knowledge Pro service logs for the failure corresponding to the returned status","Verify the node's Knowledge Pro API URL and credentials are correct and the service is reachable","If 401, refresh/fix the auth token; if 5xx, retry after the service recovers or check gateway health"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import httpx\nasync def knowledge_pro_reachable(url: str, headers: dict) -> bool:\n    try:\n        r = await httpx.AsyncClient().get(url, headers=headers, timeout=5)\n        return r.status_code < 500\n    except httpx.HTTPError:\n        return False","typeGuard":null,"tryCatchPattern":"try:\n    result = await node.async_execute(variable_pool, span)\nexcept CustomException as e:\n    if e.err_code == CodeEnum.KNOWLEDGE_REQUEST_ERROR:\n        log.error(\"Knowledge Pro HTTP failure: %s\", e.cause_error)  # contains status\n        # retry with backoff for 5xx, alert for 4xx","preventionTips":["Health-check the Knowledge Pro service before workflow runs","Verify API URL and credentials in node configuration","Add retry with exponential backoff for 5xx statuses","Monitor gateway/service uptime"],"tags":["python","http","network","workflow"],"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-15T23:17:13.987Z"}