iflytek/astron-agent · error · HTTPException
Task status query failed
Error message
Task status query failed: {e} What it means
Catch-all in query_task_status: any exception not handled earlier (network errors, the HTTPStatusError path if present, JSON issues, even the Unknown-status HTTPException re-raised) is logged and wrapped as HTTPException(500) 'Task status query failed'.
Solutions
- Inspect the logged '{e}' message to find the root cause (connect error, timeout, decode)
- Check network connectivity and timeout settings for the query endpoint
- Validate upstream returns JSON with the expected envelope
- Distinguish already-wrapped HTTPExceptions from new failures to avoid double-wrapping
Example fix
// before
except Exception as e:
logger.error(f"Task status query failed: {e}")
raise HTTPException(status_code=500, detail=f"Task status query failed: {e}") from e
// after
except HTTPException:
raise # do not double-wrap already-classified errors
except Exception as e:
logger.exception("Task status query failed")
raise HTTPException(status_code=500, detail=f"Task status query failed: {e}") from e Defensive patterns
Strategy: try-catch
Validate before calling
socket.gethostbyname(host) # verify query endpoint reachable before polling
Try / catch
try:
result = await query_task_status(task_id, token)
except HTTPException as e:
logger.warning(f"query failed: {e.detail}")
await asyncio.sleep(backoff)
# retry or mark task state unknown Prevention
- Add explicit httpx timeouts
- Retry with backoff on transient network errors
- Re-raise already-wrapped HTTPExceptions instead of double-wrapping
- Log tracebacks (logger.exception) for root-cause analysis
When it happens
Trigger: httpx connect/timeout errors during GET, non-JSON response body causing .json() to raise, or any other unexpected exception inside the try block.
Common situations: RPA query service unreachable, request timeouts, upstream returning HTML error pages instead of JSON, regressions surfacing as this generic wrapper.
Understand the failure class
Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.
Related errors
- Task creation failed
- sandbox-exec failed: HTTP
- Skill resource download failed: HTTP
- MODEL_CHECK_FAILED
- REPO_KNOWLEDGE_DOWNLOAD_FAILED
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/b0cb054771a749c2.
Report an issue: GitHub.
Appendix: source
Thrown at core/plugin/rpa/infra/xiaowu/tasks.py:174
r_code = result.get("code", "-1")
r_msg = result.get("msg", "")
r_data = result.get("data", {})
return (
ErrorCode.TASK_EXEC_FAILED.code,
f"{ErrorCode.TASK_EXEC_FAILED.message}: {r_code}-{r_msg}",
r_data or {},
)
elif status in ["PENDING"]:
return None
raise HTTPException(
status_code=500, detail=f"Unknown task status: {status}"
)
except Exception as e:
logger.error(f"Task status query failed: {e}")
raise HTTPException(
status_code=500, detail=f"Task status query failed: {e}"
) from e
View on GitHub (pinned to 5e758547a8)