{"record":{"id":"66b0e648904a952b","repo":"iflytek/astron-agent","slug":"task-creation-failed-msg","errorCode":null,"errorMessage":"Task creation failed: {msg}","messagePattern":"Task creation failed: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"core/plugin/rpa/infra/xiaowu/tasks.py","lineNumber":66,"sourceCode":"    async with httpx.AsyncClient() as client:\n        try:\n            assert task_create_url is not None\n            logger.info(\n                f\"create_task_url:{task_create_url} header:{header}, body:{body}\"\n            )\n            response = await client.post(task_create_url, headers=header, json=body)\n            response.raise_for_status()\n\n            response_data = response.json()\n            logger.debug(f\"create task response_data:\\n {response_data}\\n\\n\")\n\n            code = response_data.get(\"code\", \"-1\")\n            msg = response_data.get(\"msg\", None)\n            data = response_data.get(\"data\", None)\n\n            if code != \"0000\" or not data:\n                logger.error(f\"Task creation failed: {msg}\")\n                raise HTTPException(\n                    status_code=500, detail=f\"Task creation failed: {msg}\"\n                )\n\n            task_id = data.get(\"executionId\", None)\n            if not task_id:\n                logger.error(\"Task creation failed: No task ID returned\")\n                raise HTTPException(\n                    status_code=500,\n                    detail=f\"Task creation failed: No task ID returned: {response_data}\",\n                )\n\n            return task_id\n        except httpx.HTTPStatusError as e:\n            logger.error(f\"Task creation failed: {e.response.text}\")\n            raise HTTPException(\n                status_code=e.response.status_code,\n                detail=f\"Task creation failed: {e.response.text}\",\n            ) from e","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/plugin/rpa/infra/xiaowu/tasks.py#L48-L84","documentation":"create_task in the Xiaowu RPA integration raises HTTPException(500) when the remote task-creation API responds with code != '0000' or an empty data payload. It means the upstream RPA service rejected or returned no usable result for the creation request.","triggerScenarios":"POST to the Xiaowu task-creation URL succeeds at HTTP level but the JSON body has code != '0000' or data is None/empty.","commonSituations":"Upstream RPA service outages or partial degradation, invalid request payload rejected by the API, expired/invalid access token surfaced as an API-level code, or upstream maintenance returning error envelopes.","solutions":["Log the full response body and check the upstream msg for the concrete API error","Verify XIAOWU_RPA_TASK_CREATE_URL config and that the service is reachable/healthy","Check the access token passed in Authorization header is valid and not expired","Add retry with backoff for transient upstream failures"],"exampleFix":"// before\nraise HTTPException(status_code=500, detail=f\"Task creation failed: {msg}\")\n// after\n# surface the upstream code too for easier diagnosis\nraise HTTPException(status_code=500, detail=f\"Task creation failed: code={code} msg={msg}\")","handlingStrategy":"try-catch","validationCode":"resp = await client.post(url, json=payload, headers=headers)\nbody = resp.json()\nif body.get(\"code\") != \"0000\" or not body.get(\"data\"):\n    print(f\"Upstream will reject creation: {body.get('code')}:{body.get('msg')}\")","typeGuard":null,"tryCatchPattern":"try:\n    task_id = await create_task(payload)\nexcept HTTPException as e:\n    logger.error(f\"create_task rejected: {e.detail}\")\n    # surface to user / retry with backoff if transient","preventionTips":["Validate the payload against the upstream API contract before calling","Keep the access token fresh and check expiry before requests","Monitor upstream RPA service health","Log full response envelopes for diagnosis"],"tags":["http","upstream-api","rpa"],"backgroundTag":"api-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"}