iflytek/astron-agent · error · HTTPException
Task creation failed: No task ID returned
Error message
Task creation failed: No task ID returned: {response_data} What it means
Raised when the Xiaowu create-task API returned code '0000' but the data.executionId field is missing or empty. The call 'succeeded' per the API contract, yet no task identifier was produced, so the caller cannot poll status later.
Solutions
- Log/inspect response_data and confirm the actual field name for the task ID
- Verify you are calling the correct environment (prod vs stub) with the matching API contract
- Ask the upstream team about the successful-but-empty response
- Add a schema check/assertion on the expected response shape
Example fix
// before
task_id = data.get("executionId", None)
// after
task_id = data.get("executionId") or data.get("execution_id") # tolerate contract variants
if not task_id:
raise HTTPException(status_code=500, detail=f"Task creation failed: No task ID returned: {response_data}") Defensive patterns
Strategy: validation
Validate before calling
data = response_data.get("data") or {}
if not (data.get("executionId") or data.get("execution_id")):
raise ValueError(f"No executionId in creation response: {response_data}") Type guard
def has_task_id(data: dict | None) -> bool:
return bool(isinstance(data, dict) and (data.get("executionId") or data.get("execution_id"))) Prevention
- Pin and test against the upstream API contract/schema
- Add a response schema assertion in integration tests
- Check which environment (prod/stub) the URL points to
- Alert on success-with-empty-payload patterns upstream
When it happens
Trigger: response_data['code'] == '0000' but response_data['data'] is missing 'executionId' or it is None/empty string.
Common situations: Upstream API contract change (executionId renamed or nested differently), upstream bug returning success envelope with empty payload, environment pointing at a stub/mock service.
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 status query failed: No task information 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/0e81ae6980bbf6d4.
Report an issue: GitHub.
Appendix: source
Thrown at core/plugin/rpa/infra/xiaowu/tasks.py:73
response.raise_for_status()
response_data = response.json()
logger.debug(f"create 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 creation failed: {msg}")
raise HTTPException(
status_code=500, detail=f"Task creation failed: {msg}"
)
task_id = data.get("executionId", None)
if not task_id:
logger.error("Task creation failed: No task ID returned")
raise HTTPException(
status_code=500,
detail=f"Task creation failed: No task ID returned: {response_data}",
)
return task_id
except httpx.HTTPStatusError as e:
logger.error(f"Task creation failed: {e.response.text}")
raise HTTPException(
status_code=e.response.status_code,
detail=f"Task creation failed: {e.response.text}",
) from e
except Exception as e:
logger.error(f"Task creation failed: {e}")
raise HTTPException(
status_code=500, detail=f"Task creation failed: {e}"
) from e
View on GitHub (pinned to 5e758547a8)