{"record":{"id":"0d985bc13fa5edfc","repo":"langflow-ai/langflow","slug":"provider-data-llm-is-required-for-new-agent-creati","errorCode":null,"errorMessage":"provider_data.llm is required for new agent creation.","messagePattern":"provider_data\\.llm is required for new agent creation\\.","errorType":"validation","errorClass":"ValueError","httpStatus":422,"severity":"error","filePath":"src/backend/base/langflow/api/v1/mappers/deployments/watsonx_orchestrate/payloads.py","lineNumber":386,"sourceCode":"    @model_validator(mode=\"after\")\n    def validate_create_operation_requirements(self) -> WatsonxApiDeploymentCreatePayload:\n        if \"existing_agent_id\" in self.model_fields_set:\n            if self.existing_agent_id is None:\n                msg = \"provider_data.existing_agent_id cannot be set to null.\"\n                raise ValueError(msg)\n            if len(self.model_fields_set) > 1:\n                msg = (\n                    \"existing_agent_id is only for tracking existing wxO agents in Langflow and cannot include \"\n                    \"fields that update the wxO agent. Update the deployment after it is tracked.\"\n                )\n                raise ValueError(msg)\n            return self\n        if self.display_name is None:\n            msg = \"provider_data.display_name is required for new agent creation.\"\n            raise ValueError(msg)\n        if self.llm is None:\n            msg = \"provider_data.llm is required for new agent creation.\"\n            raise ValueError(msg)\n        # TODO: Allow wxO agent creation without initial flows/tools once the adapter create path supports it.\n        if not (self.add_flows or self.upsert_tools):\n            msg = \"provider_data must include at least one add_flows or upsert_tools item for new agent creation.\"\n            raise ValueError(msg)\n        _validate_api_unique_connection_app_ids(connections=self.connections)\n        raw_app_ids = {raw.app_id for raw in self.connections}\n        referenced_app_ids = _collect_api_referenced_app_ids(self.add_flows, attr_name=\"app_ids\")\n        referenced_app_ids.update(_collect_api_referenced_app_ids(self.upsert_tools, attr_name=\"add_app_ids\"))\n        _validate_api_unused_raw_app_ids(raw_app_ids=raw_app_ids, referenced_app_ids=referenced_app_ids)\n        return self\n\n    def validate_with_outer_fields(self, outer_payload: DeploymentCreateRequest) -> None:\n        if self.existing_agent_id is None or \"description\" not in outer_payload.model_fields_set:\n            return\n        msg = \"When existing_agent_id is provided, Langflow uses the description already set for the agent in wxO.\"\n        raise ValueError(msg)\n\n","sourceCodeStart":368,"sourceCodeEnd":404,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/src/backend/base/langflow/api/v1/mappers/deployments/watsonx_orchestrate/payloads.py#L368-L404","documentation":"Model validator on WatsonxApiDeploymentCreatePayload: when creating a NEW wxO agent, provider_data.llm (the model id the agent uses) is mandatory. Missing llm raises ValueError 'provider_data.llm is required for new agent creation.' and FastAPI returns 422.","triggerScenarios":"POST /deployments creating a new agent where provider_data omits llm (and existing_agent_id is not used).","commonSituations":"Client assumes a default model server-side; model picker optional in the UI and submitted empty; refactoring that renamed the field (e.g. model vs llm).","solutions":["Set provider_data.llm to a valid wxO model id (e.g. 'mistral_large_2' per your wxO tenant's catalog).","Make the model field required in the client form before submit.","Verify the model id against the wxO instance — an invalid id will fail later at the provider even if present."],"exampleFix":"// before\n{\"provider_data\": {\"display_name\": \"Bot\", \"add_flows\": [...]}}\n// after\n{\"provider_data\": {\"display_name\": \"Bot\", \"llm\": \"mistral_large_2\", \"add_flows\": [...]}}","handlingStrategy":"validation","validationCode":"if provider_data.get(\"existing_agent_id\") is None:\n    assert provider_data.get(\"llm\", \"\").strip(), \"llm required for new agent creation\"","typeGuard":"const hasCreateLlm = (pd: Record<string, unknown>): boolean =>\n  pd.existing_agent_id !== undefined || (typeof pd.llm === \"string\" && pd.llm.trim().length > 0);","tryCatchPattern":null,"preventionTips":["Make model selection mandatory in the agent-create UI.","Validate the model id against the wxO tenant catalog before submit.","Keep field name 'llm' — renaming client-side to 'model' silently drops it."],"tags":["watsonx-orchestrate","pydantic","validation","http-422","required-field","llm"],"backgroundTag":null,"analyzedSha":"976ec789d2886a86de109c044d089d68e96c9a35","analyzedAt":"2026-08-14T18:23:12.227Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}