{"record":{"id":"24d7232bb1320624","repo":"BerriAI/litellm","slug":"cp4d-host-is-required-in-litellm-params-for-wxo","errorCode":null,"errorMessage":"'cp4d_host' is required in litellm_params for WXO agents","messagePattern":"'cp4d_host' is required in litellm_params for WXO agents","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/a2a_protocol/providers/watsonx_orchestrate/handler.py","lineNumber":197,"sourceCode":"                continue\n            try:\n                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","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/a2a_protocol/providers/watsonx_orchestrate/handler.py#L179-L215","documentation":"_extract_litellm_params() validates the deployment metadata for Watsonx Orchestrate agents before any request is made. cp4d_host (the Cloud Pak for Data / WXO base URL) is mandatory; an empty or missing value raises this ValueError immediately. All WXO routing and token URLs are derived from this host, so the handler cannot proceed without it.","triggerScenarios":"A watsonx_orchestrate deployment in config.yaml whose litellm_params omits cp4d_host; cp4d_host sourced from an unset env var so it resolves to empty; a typo like cp4d-url: leaving the real key absent.","commonSituations":"First-time WXO agent setup in the LiteLLM proxy; copying an example config and deleting the host line; env var name drift between environments (WXO_HOST vs CP4D_HOST); secrets-management templates that render the key only in some environments.","solutions":["Add cp4d_host (e.g. https://cp4d.example.com) to the WXO deployment's litellm_params","If using os.environ/..., confirm the variable is set in the proxy's runtime environment","Use the exact key name cp4d_host and keep it inside litellm_params","Restart/reload the proxy after fixing config.yaml"],"exampleFix":"# before (config.yaml)\nlitellm_params:\n  model: watsonx_orchestrate/my-agent\n  instance_id: my-instance\n  wxo_agent_id: my-agent\n  api_key: os.environ/WXO_API_KEY\n\n# after\nlitellm_params:\n  model: watsonx_orchestrate/my-agent\n  cp4d_host: https://cp4d.example.com\n  instance_id: my-instance\n  wxo_agent_id: my-agent\n  api_key: os.environ/WXO_API_KEY\n","handlingStrategy":"validation","validationCode":"REQUIRED_WXO_KEYS = (\"cp4d_host\", \"instance_id\", \"wxo_agent_id\", \"api_key\")\n\ndef validate_wxo_deployment(litellm_params: dict) -> None:\n    missing = [k for k in REQUIRED_WXO_KEYS if not litellm_params.get(k)]\n    if missing:\n        raise ValueError(f\"watsonx_orchestrate deployment missing: {', '.join(missing)}\")\n","typeGuard":null,"tryCatchPattern":"try:\n    result = await WatsonxOrchestrateHandler.handle_request(params)\nexcept ValueError as e:\n    if \"'cp4d_host' is required\" in str(e):\n        raise HTTPException(500, \"WXO deployment missing cp4d_host\") from e\n    raise\n","preventionTips":["Template WXO deployments from one validated example containing all four required keys","Check env vars backing cp4d_host at proxy startup","Run the config through a YAML linter that understands watsonx_orchestrate requirements"],"tags":["watsonx-orchestrate","cp4d-host","configuration","required-param"],"backgroundTag":"missing-required-argument","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}