{"record":{"id":"21fffe049f420043","repo":"langflow-ai/langflow","slug":"when-existing-agent-id-is-provided-langflow-uses","errorCode":null,"errorMessage":"When existing_agent_id is provided, Langflow uses the description already set for the agent in wxO.","messagePattern":"When existing_agent_id is provided, Langflow uses the description already set for the agent in wxO\\.","errorType":"validation","errorClass":"ValueError","httpStatus":422,"severity":"error","filePath":"src/backend/base/langflow/api/v1/mappers/deployments/watsonx_orchestrate/payloads.py","lineNumber":402,"sourceCode":"        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\nclass WatsonxApiCreatedTool(BaseModel):\n    \"\"\"API response shape for a tool created from a Langflow flow version.\"\"\"\n\n    model_config = {\"extra\": \"forbid\"}\n\n    flow_version_id: UUID\n    tool_id: NonEmptyString = Field(description=\"Provider-owned tool identifier.\")\n\n    @field_validator(\"flow_version_id\", mode=\"before\")\n    @classmethod\n    def normalize_flow_version_id(cls, value: Any) -> UUID:\n        if isinstance(value, UUID):\n            return value\n        if not isinstance(value, str):\n            msg = \"flow_version_id must be provided as a UUID string or UUID object.\"\n            raise ValueError(msg)  # noqa: TRY004","sourceCodeStart":384,"sourceCodeEnd":420,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/src/backend/base/langflow/api/v1/mappers/deployments/watsonx_orchestrate/payloads.py#L384-L420","documentation":"Cross-field validator (validate_with_outer_fields) on WatsonxApiDeploymentCreatePayload: when existing_agent_id is provided, Langflow keeps the description already set on the wxO agent, so the outer DeploymentCreateRequest must not include a description key. Sending one raises ValueError with that explanation (422).","triggerScenarios":"POST /deployments with description set on the outer request body while provider_data.existing_agent_id is present.","commonSituations":"Client always sending a description field; UI description box left filled when the user switches to 'track existing agent' mode; generated clients including all optional fields.","solutions":["Remove description from the outer request body when tracking an existing agent.","If you need a different description, change it in wxO (or via a later deployment update if supported), not at tracked-create time.","Conditionally strip description in the client when existing_agent_id is set."],"exampleFix":"// before\n{\"name\": \"Tracked\", \"description\": \"my desc\", \"provider_data\": {\"existing_agent_id\": \"agent-1\"}}\n// after\n{\"name\": \"Tracked\", \"provider_data\": {\"existing_agent_id\": \"agent-1\"}}","handlingStrategy":"validation","validationCode":"if provider_data.get(\"existing_agent_id\") is not None and \"description\" in outer_body:\n    del outer_body[\"description\"]  # wxO keeps its own description","typeGuard":"const trackCreateIsMinimal = (outer: Record<string, unknown>, pd: Record<string, unknown>): boolean =>\n  pd.existing_agent_id === undefined || !(\"description\" in outer);","tryCatchPattern":null,"preventionTips":["Strip description from the outer request when existing_agent_id is set.","Edit descriptions on the wxO side for tracked agents.","Write one conditional serializer branch for track-mode creates."],"tags":["watsonx-orchestrate","pydantic","validation","http-422","existing-agent","description"],"backgroundTag":null,"analyzedSha":"976ec789d2886a86de109c044d089d68e96c9a35","analyzedAt":"2026-08-14T18:23:12.227Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}