BerriAI/litellm · error · ValueError
'instance_id' is required in litellm_params for WXO agents
Error message
'instance_id' is required in litellm_params for WXO agents
What it means
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.
Source
Thrown at litellm/a2a_protocol/providers/watsonx_orchestrate/handler.py:199
event = json.loads(data_str)
except json.JSONDecodeError:
continue
chunk_text = WatsonxOrchestrateTransformation.extract_text_from_wxo_result(event)
if chunk_text:
accumulated_text += chunk_text
return accumulated_text
@staticmethod
def _extract_litellm_params(litellm_params: dict[str, Any]) -> WXORequestParams:
cp4d_host: Final = litellm_params.get("cp4d_host") or ""
instance_id: Final = litellm_params.get("instance_id") or ""
wxo_agent_id: Final = litellm_params.get("wxo_agent_id") or ""
api_key: Final = litellm_params.get("api_key") or ""
if not cp4d_host:
raise ValueError("'cp4d_host' is required in litellm_params for WXO agents")
if not instance_id:
raise ValueError("'instance_id' is required in litellm_params for WXO agents")
if not wxo_agent_id:
raise ValueError("'wxo_agent_id' is required in litellm_params for WXO agents")
if not api_key:
raise ValueError("'api_key' is required in litellm_params for WXO agents")
return WXORequestParams(
cp4d_host=cp4d_host,
instance_id=instance_id,
wxo_agent_id=wxo_agent_id,
api_key=api_key,
username=litellm_params.get("username") or None,
auth_mode=litellm_params.get("auth_mode") or "cp4d",
thread_id=litellm_params.get("thread_id") or None,
)
@staticmethod
async def handle_non_streaming(
request_id: str,View on GitHub (pinned to 6c2dcb801b)
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.
Example fix
# before litellm_params: model: watsonx_orchestrate/agent cp4d_host: https://cpd.example.com:443 wxo_agent_id: my-agent # after litellm_params: model: watsonx_orchestrate/agent cp4d_host: https://cpd.example.com:443 instance_id: 1f2a3b4c-... wxo_agent_id: my-agent
Defensive patterns
Strategy: validation
Validate before calling
def validate_wxo_config(litellm_params: dict) -> None:
missing = [k for k in ("cp4d_host", "instance_id", "wxo_agent_id", "api_key") if not litellm_params.get(k)]
if missing:
raise ConfigError(f"WXO config missing: {missing}") Type guard
def has_valid_wxo_config(p: dict) -> bool:
return all(isinstance(p.get(k), str) and p[k].strip() for k in ("cp4d_host", "instance_id", "wxo_agent_id", "api_key")) Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- 'cp4d_host' is required in litellm_params for WXO agents
- 'wxo_agent_id' is required in litellm_params for WXO agents
- 'api_key' is required in litellm_params for WXO agents
- Invalid mode: {custom_auth_settings['mode']}
- litellm_params is required for WatsonxOrchestrateA2AConfig (
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/71f16c07d3238fb9.
Report an issue: GitHub.