{"record":{"id":"7c651670796a9b7b","repo":"iflytek/astron-agent","slug":"http-error-text","errorCode":null,"errorMessage":"HTTP Error: {text}","messagePattern":"HTTP Error: (.+?)","errorType":"http","errorClass":"ClientResponseError","httpStatus":null,"severity":"error","filePath":"core/workflow/engine/nodes/memory/base.py","lineNumber":91,"sourceCode":"                api_secret=os.getenv(\"MEMORY_AUTH_SECRET\", \"\"),\n            )\n\n        payload = self.build_payload(uid, inputs)\n        await span.add_info_event_async(f\"Memory API Request Payload: {payload}\")\n\n        headers = {\n            \"Content-Type\": \"application/json\",\n            \"x-appid\": self.app_id,\n        }\n\n        session = HttpClient.get_session()\n        async with session.post(url, headers=headers, json=payload) as response:\n            if response.status != 200:\n                text = await response.text()\n                await span.add_info_event_async(\n                    f\"Memory API HTTP error: {response.status}:{text}\"\n                )\n                raise aiohttp.ClientResponseError(\n                    request_info=response.request_info,\n                    history=response.history,\n                    status=response.status,\n                    message=f\"HTTP Error: {text}\",\n                )\n\n            raw_data = cast(dict[str, Any], await response.json())\n            await span.add_info_event_async(f\"Memory API Response Data: {raw_data}\")\n            if raw_data.get(\"code\") != 0:\n                raise CustomException(\n                    CodeEnum.MEMORY_NODE_EXECUTION_ERROR,\n                    f\"Memory API Exception: {raw_data.get('code')}: {raw_data.get('message')}\",\n                )\n            return raw_data\n\n    async def execute(\n        self,\n        variable_pool: VariablePool,","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/workflow/engine/nodes/memory/base.py#L73-L109","documentation":"This aiohttp ClientResponseError is raised by the workflow memory node's _do_request when the remote Memory API returns any HTTP status other than 200. The response body is captured in the error message and logged to the tracing span, so the text usually reveals the upstream failure reason. It wraps the failed HTTP exchange rather than a local bug.","triggerScenarios":"execute() calls _do_request, which does session.post(url, headers, json=payload); the server responds with status != 200 (e.g. 401 invalid token, 404 wrong path, 500 backend crash), and the body text is embedded into the raised ClientResponseError.","commonSituations":"Misconfigured MEMORY_API base URL or path, expired/missing auth token in headers, Memory API deployed with a breaking version change, gateway returning 502/503 during restarts, or payload rejected with 400 due to schema drift.","solutions":["Read the message body (also visible in the span info event 'Memory API HTTP error: <status>:<text>') to identify the upstream status and fix accordingly","Verify the Memory API URL and auth headers configured for the memory node","Call the Memory API endpoint directly with curl using the same payload to reproduce and debug","Add retry logic for transient 5xx statuses and alert on persistent non-200 responses"],"exampleFix":"// before\nraise aiohttp.ClientResponseError(request_info=response.request_info, history=response.history, status=response.status, message=f\"HTTP Error: {text}\")\n// after\nif response.status >= 500 and attempt < max_retries:\n    await asyncio.sleep(backoff); continue\nraise aiohttp.ClientResponseError(request_info=response.request_info, history=response.history, status=response.status, message=f\"Memory API returned {response.status}: {text}\")","handlingStrategy":"try-catch","validationCode":"# before calling the node, probe the Memory API health\nasync def memory_api_reachable(url, headers):\n    try:\n        async with aiohttp.ClientSession() as s:\n            async with s.get(url.rsplit('/', 1)[0] + '/health', headers=headers, timeout=aiohttp.ClientTimeout(total=5)) as r:\n                return r.status == 200\n    except aiohttp.ClientError:\n        return False","typeGuard":null,"tryCatchPattern":"try:\n    result = await memory_node.execute(...)\nexcept aiohttp.ClientResponseError as e:\n    logger.error(\"memory api failed: status=%s body=%s\", e.status, e.message)\n    raise MemoryUnavailableError(...) from e","preventionTips":["Health-check the Memory API before running workflows that use memory nodes","Keep auth tokens fresh and verify the configured base URL after any service redeploy","Alert on 5xx rates from the Memory API"],"tags":["network","http","aiohttp","memory-api"],"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"}