{"record":{"id":"71f16c07d3238fb9","repo":"BerriAI/litellm","slug":"instance-id-is-required-in-litellm-params-for-wx","errorCode":null,"errorMessage":"'instance_id' is required in litellm_params for WXO agents","messagePattern":"'instance_id' is required in litellm_params for WXO agents","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/a2a_protocol/providers/watsonx_orchestrate/handler.py","lineNumber":199,"sourceCode":"                event = json.loads(data_str)\n            except json.JSONDecodeError:\n                continue\n            chunk_text = WatsonxOrchestrateTransformation.extract_text_from_wxo_result(event)\n            if chunk_text:\n                accumulated_text += chunk_text\n        return accumulated_text\n\n    @staticmethod\n    def _extract_litellm_params(litellm_params: dict[str, Any]) -> WXORequestParams:\n        cp4d_host: Final = litellm_params.get(\"cp4d_host\") or \"\"\n        instance_id: Final = litellm_params.get(\"instance_id\") or \"\"\n        wxo_agent_id: Final = litellm_params.get(\"wxo_agent_id\") or \"\"\n        api_key: Final = litellm_params.get(\"api_key\") or \"\"\n\n        if not cp4d_host:\n            raise ValueError(\"'cp4d_host' is required in litellm_params for WXO agents\")\n        if not instance_id:\n            raise ValueError(\"'instance_id' is required in litellm_params for WXO agents\")\n        if not wxo_agent_id:\n            raise ValueError(\"'wxo_agent_id' is required in litellm_params for WXO agents\")\n        if not api_key:\n            raise ValueError(\"'api_key' is required in litellm_params for WXO agents\")\n\n        return WXORequestParams(\n            cp4d_host=cp4d_host,\n            instance_id=instance_id,\n            wxo_agent_id=wxo_agent_id,\n            api_key=api_key,\n            username=litellm_params.get(\"username\") or None,\n            auth_mode=litellm_params.get(\"auth_mode\") or \"cp4d\",\n            thread_id=litellm_params.get(\"thread_id\") or None,\n        )\n\n    @staticmethod\n    async def handle_non_streaming(\n        request_id: str,","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/a2a_protocol/providers/watsonx_orchestrate/handler.py#L181-L217","documentation":"Configuration validation error from the WXO handler: 'instance_id' is missing or empty in litellm_params. The watsonx Orchestrate space/project instance id is required to scope API calls to the right WXO instance, so the handler raises ValueError immediately rather than sending an unscoped request.","triggerScenarios":"WXO model config (proxy config.yaml or direct call kwargs) that omits 'instance_id' or passes an empty string. Only triggered after cp4d_host has already passed its check, since the checks run in order.","commonSituations":"Confusing the WXO instance id with the wxo_agent_id or the CP4D project id; forgetting to copy the instance id from the watsonx Orchestrate UI; empty env var expansion in templated configs.","solutions":["Add 'instance_id' to litellm_params for the WXO model, taken from your watsonx Orchestrate instance settings.","Verify the value is non-empty after env var substitution if the config uses os.environ references.","Do not confuse instance_id with wxo_agent_id — the agent id check is separate and runs after this one."],"exampleFix":"# before\nlitellm_params:\n  model: watsonx_orchestrate/agent\n  cp4d_host: https://cpd.example.com:443\n  wxo_agent_id: my-agent\n\n# after\nlitellm_params:\n  model: watsonx_orchestrate/agent\n  cp4d_host: https://cpd.example.com:443\n  instance_id: 1f2a3b4c-...\n  wxo_agent_id: my-agent","handlingStrategy":"validation","validationCode":"def validate_wxo_config(litellm_params: dict) -> None:\n    missing = [k for k in (\"cp4d_host\", \"instance_id\", \"wxo_agent_id\", \"api_key\") if not litellm_params.get(k)]\n    if missing:\n        raise ConfigError(f\"WXO config missing: {missing}\")","typeGuard":"def has_valid_wxo_config(p: dict) -> bool:\n    return all(isinstance(p.get(k), str) and p[k].strip() for k in (\"cp4d_host\", \"instance_id\", \"wxo_agent_id\", \"api_key\"))","tryCatchPattern":null,"preventionTips":["Copy the instance id directly from the watsonx Orchestrate UI to avoid transcription errors.","Run config validation in CI for all proxy config changes.","Distinguish instance_id (WXO instance) from wxo_agent_id (agent) in internal docs."],"tags":["watsonx-orchestrate","configuration","validation","instance-id"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}