BerriAI/litellm · error · ValueError
WXO: No run_id in response
Error message
WXO: No run_id in response: {run_data} What it means
After kicking off a run on Watsonx Orchestrate, the handler needs a run identifier to poll /runs/{run_id} until a terminal state. It tries run_data['run_id'] then run_data['id']; if both are missing it raises this ValueError echoing the whole response body. That means the WXO API replied without any run identifier — typically an error payload, an auth rejection, or an unexpected response shape rather than a normal accepted run.
Solutions
- Log the full run_data from the exception — the embedded body usually names the real problem (auth, unknown agent, wrong instance)
- Verify wxo_agent_id and instance_id match the agent actually deployed in WXO
- Re-check credentials (api_key/username) and confirm the token exchange succeeded
- Upgrade LiteLLM if the WXO response schema changed in a supported newer version
Example fix
# before
run_data = await client.post(run_url, headers=auth_headers)
final = WatsonxOrchestrateHandler._get_successful_run_data(
run_data=run_data.json(), base_url=base_url,
auth_headers=auth_headers, client=client,
)
# after
try:
final = WatsonxOrchestrateHandler._get_successful_run_data(
run_data=run_data.json(), base_url=base_url,
auth_headers=auth_headers, client=client,
)
except ValueError as e:
logger.error("WXO returned no run_id, raw body: %s", e)
raise HTTPException(status_code=502, detail="WXO did not start a run") from e
Defensive patterns
Strategy: try-catch
Validate before calling
def response_has_run_id(run_data: dict) -> bool:
return bool(run_data.get("run_id") or run_data.get("id"))
Try / catch
try:
final = WatsonxOrchestrateHandler._get_successful_run_data(run_data, base_url, headers, client)
except ValueError as e:
logger.error("WXO run start failed, raw response in message")
raise HTTPException(502, "WXO did not return a runnable id") from e
Prevention
- Verify wxo_agent_id / instance_id / credentials before relying on run creation
- Log full WXO response bodies at debug level to diagnose shape changes fast
- Pin the WXO API version you tested against and re-test on platform upgrades
When it happens
Trigger: WXO returning an error object (401/403/404 body) instead of a created run because the token, instance_id, or wxo_agent_id is wrong; an API-version mismatch where the field is named differently; an empty or HTML error page parsed into a dict without run_id/id.
Common situations: Expired or invalid CP4D/IAM tokens producing error JSON; wrong wxo_agent_id so the runs endpoint 404s with an error body; WXO SaaS vs CP4D response-shape differences across versions; gateway/proxy in front of WXO rewriting responses.
Related errors
- WXO run ended with non-success status
- 'api_key' is required in litellm_params for WXO agents
- 'cp4d_host' is required in litellm_params for WXO agents
- Error
- Failed to generate marketplace
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/4b147965f2ce9297.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/a2a_protocol/providers/watsonx_orchestrate/handler.py:157
if status in WatsonxOrchestrateTransformation.TERMINAL_STATES:
return result
raise asyncio.TimeoutError(
f"WXO run '{run_id}' did not reach a terminal state after {max_attempts * interval_s:.0f}s"
)
@staticmethod
async def _get_successful_run_data(
run_data: dict[str, Any],
base_url: str,
auth_headers: dict[str, str],
client: AsyncHTTPHandler,
) -> dict[str, Any]:
status = run_data.get("status", "")
if status not in WatsonxOrchestrateTransformation.TERMINAL_STATES:
run_id: Final = run_data.get("run_id") or run_data.get("id") or ""
if not run_id:
raise ValueError(f"WXO: No run_id in response: {run_data}")
run_data = await WatsonxOrchestrateHandler._poll_run(
base_url=base_url,
run_id=run_id,
auth_headers=auth_headers,
client=client,
)
status = run_data.get("status", "")
if status not in WatsonxOrchestrateTransformation.SUCCESS_STATES:
raise RuntimeError(f"WXO run ended with non-success status '{status}': {run_data}")
return run_data
@staticmethod
async def _accumulate_wxo_sse_text(response: Any) -> str:
accumulated_text = ""
async for line in response.aiter_lines():
if not line.startswith("data:"):View on GitHub (pinned to 77b7c6c40c)