{"record":{"id":"ffb818f9b932b1d6","repo":"langflow-ai/langflow","slug":"existing-agent-id-is-only-for-tracking-existing-wx","errorCode":null,"errorMessage":"existing_agent_id is only for tracking existing wxO agents in Langflow and cannot include fields that update the wxO agent. Update the deployment after it is tracked.","messagePattern":"existing_agent_id is only for tracking existing wxO agents in Langflow and cannot include fields that update the wxO agent\\. Update the deployment after it is tracked\\.","errorType":"validation","errorClass":"ValueError","httpStatus":422,"severity":"error","filePath":"src/backend/base/langflow/api/v1/mappers/deployments/watsonx_orchestrate/payloads.py","lineNumber":379,"sourceCode":"        default=None,\n        description=(\n            \"Provider-owned agent id to track in Langflow instead of creating a new wxO agent. \"\n            \"When provided, the request must not include fields that would update the wxO agent.\"\n        ),\n    )\n\n    @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","sourceCodeStart":361,"sourceCodeEnd":397,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/src/backend/base/langflow/api/v1/mappers/deployments/watsonx_orchestrate/payloads.py#L361-L397","documentation":"Model validator on WatsonxApiDeploymentCreatePayload: when existing_agent_id is provided, it must be the ONLY field set in provider_data — Langflow merely tracks the existing wxO agent and must not be asked to modify it at create time. Any additional field (display_name, llm, add_flows, connections, ...) raises ValueError with guidance to update the deployment after it is tracked (422).","triggerScenarios":"POST /deployments with provider_data containing existing_agent_id together with any other field such as display_name, llm, add_flows, or upsert_tools.","commonSituations":"Reusing a full create-payload template and just adding existing_agent_id; UI not switching to 'track existing agent' mode; misunderstanding that tracking is a distinct, minimal operation.","solutions":["Send provider_data with exactly one key: {\"existing_agent_id\": \"<wxo-agent-id>\"}.","To modify the agent (flows, tools, llm, display name), first create the tracked deployment, then issue a deployment update.","Reset the create form / payload builder to a minimal object when tracking mode is selected."],"exampleFix":"// before\n{\"provider_data\": {\"existing_agent_id\": \"agent-1\", \"display_name\": \"My agent\", \"add_flows\": [...]}}\n// after\n{\"provider_data\": {\"existing_agent_id\": \"agent-1\"}}","handlingStrategy":"validation","validationCode":"if provider_data.get(\"existing_agent_id\") is not None:\n    provider_data = {\"existing_agent_id\": provider_data[\"existing_agent_id\"]}  # sole key allowed","typeGuard":"const isTrackOnlyPayload = (pd: Record<string, unknown>): boolean =>\n  pd.existing_agent_id !== undefined && Object.keys(pd).length === 1;","tryCatchPattern":null,"preventionTips":["When tracking an existing agent, build provider_data from scratch with exactly one key.","Modify tracked agents via deployment update, never via create.","Add a client unit test asserting track-mode payloads contain only existing_agent_id."],"tags":["watsonx-orchestrate","pydantic","validation","http-422","existing-agent","payload-contract"],"backgroundTag":null,"analyzedSha":"976ec789d2886a86de109c044d089d68e96c9a35","analyzedAt":"2026-08-14T18:23:12.227Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}