{"record":{"id":"4b147965f2ce9297","repo":"BerriAI/litellm","slug":"wxo-no-run-id-in-response-run-data","errorCode":null,"errorMessage":"WXO: No run_id in response: {run_data}","messagePattern":"WXO: No run_id in response: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/a2a_protocol/providers/watsonx_orchestrate/handler.py","lineNumber":157,"sourceCode":"            if status in WatsonxOrchestrateTransformation.TERMINAL_STATES:\n                return result\n\n        raise asyncio.TimeoutError(\n            f\"WXO run '{run_id}' did not reach a terminal state after {max_attempts * interval_s:.0f}s\"\n        )\n\n    @staticmethod\n    async def _get_successful_run_data(\n        run_data: dict[str, Any],\n        base_url: str,\n        auth_headers: dict[str, str],\n        client: AsyncHTTPHandler,\n    ) -> dict[str, Any]:\n        status = run_data.get(\"status\", \"\")\n        if status not in WatsonxOrchestrateTransformation.TERMINAL_STATES:\n            run_id: Final = run_data.get(\"run_id\") or run_data.get(\"id\") or \"\"\n            if not run_id:\n                raise ValueError(f\"WXO: No run_id in response: {run_data}\")\n            run_data = await WatsonxOrchestrateHandler._poll_run(\n                base_url=base_url,\n                run_id=run_id,\n                auth_headers=auth_headers,\n                client=client,\n            )\n            status = run_data.get(\"status\", \"\")\n\n        if status not in WatsonxOrchestrateTransformation.SUCCESS_STATES:\n            raise RuntimeError(f\"WXO run ended with non-success status '{status}': {run_data}\")\n\n        return run_data\n\n    @staticmethod\n    async def _accumulate_wxo_sse_text(response: Any) -> str:\n        accumulated_text = \"\"\n        async for line in response.aiter_lines():\n            if not line.startswith(\"data:\"):","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/a2a_protocol/providers/watsonx_orchestrate/handler.py#L139-L175","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\nrun_data = await client.post(run_url, headers=auth_headers)\nfinal = WatsonxOrchestrateHandler._get_successful_run_data(\n    run_data=run_data.json(), base_url=base_url,\n    auth_headers=auth_headers, client=client,\n)\n\n# after\ntry:\n    final = WatsonxOrchestrateHandler._get_successful_run_data(\n        run_data=run_data.json(), base_url=base_url,\n        auth_headers=auth_headers, client=client,\n    )\nexcept ValueError as e:\n    logger.error(\"WXO returned no run_id, raw body: %s\", e)\n    raise HTTPException(status_code=502, detail=\"WXO did not start a run\") from e\n","handlingStrategy":"try-catch","validationCode":"def response_has_run_id(run_data: dict) -> bool:\n    return bool(run_data.get(\"run_id\") or run_data.get(\"id\"))\n","typeGuard":null,"tryCatchPattern":"try:\n    final = WatsonxOrchestrateHandler._get_successful_run_data(run_data, base_url, headers, client)\nexcept ValueError as e:\n    logger.error(\"WXO run start failed, raw response in message\")\n    raise HTTPException(502, \"WXO did not return a runnable id\") from e\n","preventionTips":["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"],"tags":["watsonx-orchestrate","run-id","api-response","polling","debugging"],"backgroundTag":"malformed-api-response","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}