iflytek/astron-agent · error · HTTPException
Task status query failed: No task information returned
Error message
Task status query failed: No task information returned
What it means
query_task_status raises HTTPException(500) with 'No task information returned' when the upstream response carries code '0000' but data is missing/empty. The monitoring loop cannot determine task state without the data payload, so it treats the query as failed.
Solutions
- Inspect the raw response to confirm the execution field name/location
- Verify the API version/contract matches the caller's expectation
- Confirm the task_id exists upstream (some APIs return empty data for unknown IDs)
- Treat unknown task IDs distinctly (404-style) rather than generic 500
Example fix
// before
execution = data.get("execution", {})
if not execution:
raise HTTPException(status_code=500, detail="Task status query failed: No task information returned")
// after
execution = data.get("execution") or {}
if not execution:
raise HTTPException(status_code=404, detail=f"Task status query failed: No execution info for task {task_id}") Defensive patterns
Strategy: validation
Validate before calling
data = body.get("data") or {}
execution = data.get("execution") or {}
assert execution, f"Success envelope missing execution: {body}" Type guard
def has_execution(data: dict | None) -> bool:
return bool(isinstance(data, dict) and data.get("execution")) Prevention
- Pin the upstream response contract in integration tests
- Treat success-with-empty-execution as task-not-found
- Watch for upstream API version changes
- Avoid stub environments in production paths
When it happens
Trigger: response_data['code'] == '0000' but response_data['data'].get('execution') is {} or None.
Common situations: Upstream API contract change renaming/nesting the execution field, upstream returning success for unknown task IDs with empty payload, stub/mock environments with partial responses.
Understand the failure class
Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.
Related errors
- Task creation failed: No task ID returned
- Task creation failed
- Task creation failed
- Task status query failed
- Task status query failed
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/b1a9651d3bf0b4fc.
Report an issue: GitHub.
Appendix: source
Thrown at core/plugin/rpa/infra/xiaowu/tasks.py:129
)
response.raise_for_status()
response_data = response.json()
logger.debug(f"query task response_data:\n {response_data}\n\n")
code = response_data.get("code", "-1")
msg = response_data.get("msg", None)
data = response_data.get("data", None)
if code != "0000" or not data:
logger.error(f"Task status query failed: {msg}")
raise HTTPException(
status_code=500, detail=f"Task status query failed: {code}:{msg}"
)
execution = data.get("execution", {})
if not execution:
logger.error("Task status query failed: No task information returned")
raise HTTPException(
status_code=500,
detail="Task status query failed: No task information returned",
)
status = execution.get("status", "")
if status in ["COMPLETED"]:
result = execution.get("result", {}) or {}
r_code = result.get("code", "-1")
r_msg = result.get("msg", "")
r_data = result.get("data", {})
return (
ErrorCode.SUCCESS.code,
f"{ErrorCode.SUCCESS.message}: {r_code}-{r_msg}",
r_data,
)
elif status in ["FAILED"]:
error = execution.get("error", "")View on GitHub (pinned to 5e758547a8)