{"record":{"id":"a80ec1473e1a14da","repo":"iflytek/astron-agent","slug":"unknown-task-status-status","errorCode":null,"errorMessage":"Unknown task status: {status}","messagePattern":"Unknown task status: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"core/plugin/rpa/infra/xiaowu/tasks.py","lineNumber":168,"sourceCode":"                    return (\n                        ErrorCode.TASK_EXEC_FAILED.code,\n                        f\"{ErrorCode.TASK_EXEC_FAILED.message}: {error}\",\n                        {},\n                    )\n\n                r_code = result.get(\"code\", \"-1\")\n                r_msg = result.get(\"msg\", \"\")\n                r_data = result.get(\"data\", {})\n                return (\n                    ErrorCode.TASK_EXEC_FAILED.code,\n                    f\"{ErrorCode.TASK_EXEC_FAILED.message}: {r_code}-{r_msg}\",\n                    r_data or {},\n                )\n\n            elif status in [\"PENDING\"]:\n                return None\n\n            raise HTTPException(\n                status_code=500, detail=f\"Unknown task status: {status}\"\n            )\n\n        except Exception as e:\n            logger.error(f\"Task status query failed: {e}\")\n            raise HTTPException(\n                status_code=500, detail=f\"Task status query failed: {e}\"\n            ) from e\n","sourceCodeStart":150,"sourceCodeEnd":177,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/plugin/rpa/infra/xiaowu/tasks.py#L150-L177","documentation":"After mapping COMPLETED and PENDING statuses, any other status value returned by the execution falls through to this HTTPException(500). The caller only knows how to interpret COMPLETED/PENDING, so an unrecognized status is surfaced as an internal error.","triggerScenarios":"execution.status is a value not in ['COMPLETED'] or ['PENDING'] — e.g. 'FAILED', 'RUNNING', 'CANCELLED', lowercase variants, or empty string.","commonSituations":"Upstream adds new status values (RUNNING/FAILED/CANCELLED) the integration never learned about, status casing differences, empty status from a contract change.","solutions":["Extend the status mapping to cover all documented upstream statuses (FAILED, RUNNING, CANCELLED, etc.)","Check upstream docs/logs for the actual status string returned","Normalize status casing before comparison (status.upper())","Handle empty status explicitly instead of hitting the unknown branch"],"exampleFix":"// before\nelif status in [\"PENDING\"]:\n    return None\nraise HTTPException(status_code=500, detail=f\"Unknown task status: {status}\")\n// after\nelif status in [\"PENDING\", \"RUNNING\", \"INIT\"]:\n    return None\nelif status in [\"FAILED\", \"CANCELLED\"]:\n    raise HTTPException(status_code=500, detail=f\"Task ended with status {status}\")\nraise HTTPException(status_code=500, detail=f\"Unknown task status: {status}\")","handlingStrategy":"validation","validationCode":"KNOWN_STATUSES = {\"COMPLETED\", \"PENDING\", \"RUNNING\", \"FAILED\", \"CANCELLED\"}\nstatus = (execution.get(\"status\") or \"\").upper()\nif status not in KNOWN_STATUSES:\n    raise ValueError(f\"Unsupported upstream status: {status!r}\")","typeGuard":"def is_known_status(s: str) -> bool:\n    return isinstance(s, str) and s.upper() in {\"COMPLETED\", \"PENDING\", \"RUNNING\", \"FAILED\", \"CANCELLED\"}","tryCatchPattern":null,"preventionTips":["Normalize status casing before comparisons","Subscribe to upstream API changelogs for new statuses","Cover every documented status in unit tests","Fail explicitly on empty status values"],"tags":["api-contract","enum","rpa"],"backgroundTag":"invalid-enum-value","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"}