langflow-ai/langflow · error · ValueError

When existing_agent_id is provided, Langflow uses the descri

Error message

When existing_agent_id is provided, Langflow uses the description already set for the agent in wxO.

What it means

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).

Source

Thrown at src/backend/base/langflow/api/v1/mappers/deployments/watsonx_orchestrate/payloads.py:402

        if self.llm is None:
            msg = "provider_data.llm is required for new agent creation."
            raise ValueError(msg)
        # TODO: Allow wxO agent creation without initial flows/tools once the adapter create path supports it.
        if not (self.add_flows or self.upsert_tools):
            msg = "provider_data must include at least one add_flows or upsert_tools item for new agent creation."
            raise ValueError(msg)
        _validate_api_unique_connection_app_ids(connections=self.connections)
        raw_app_ids = {raw.app_id for raw in self.connections}
        referenced_app_ids = _collect_api_referenced_app_ids(self.add_flows, attr_name="app_ids")
        referenced_app_ids.update(_collect_api_referenced_app_ids(self.upsert_tools, attr_name="add_app_ids"))
        _validate_api_unused_raw_app_ids(raw_app_ids=raw_app_ids, referenced_app_ids=referenced_app_ids)
        return self

    def validate_with_outer_fields(self, outer_payload: DeploymentCreateRequest) -> None:
        if self.existing_agent_id is None or "description" not in outer_payload.model_fields_set:
            return
        msg = "When existing_agent_id is provided, Langflow uses the description already set for the agent in wxO."
        raise ValueError(msg)


class WatsonxApiCreatedTool(BaseModel):
    """API response shape for a tool created from a Langflow flow version."""

    model_config = {"extra": "forbid"}

    flow_version_id: UUID
    tool_id: NonEmptyString = Field(description="Provider-owned tool identifier.")

    @field_validator("flow_version_id", mode="before")
    @classmethod
    def normalize_flow_version_id(cls, value: Any) -> UUID:
        if isinstance(value, UUID):
            return value
        if not isinstance(value, str):
            msg = "flow_version_id must be provided as a UUID string or UUID object."
            raise ValueError(msg)  # noqa: TRY004

View on GitHub (pinned to 976ec789d2)

Solutions

  1. Remove description from the outer request body when tracking an existing agent.
  2. If you need a different description, change it in wxO (or via a later deployment update if supported), not at tracked-create time.
  3. Conditionally strip description in the client when existing_agent_id is set.

Example fix

// before
{"name": "Tracked", "description": "my desc", "provider_data": {"existing_agent_id": "agent-1"}}
// after
{"name": "Tracked", "provider_data": {"existing_agent_id": "agent-1"}}
Defensive patterns

Strategy: validation

Validate before calling

if provider_data.get("existing_agent_id") is not None and "description" in outer_body:
    del outer_body["description"]  # wxO keeps its own description

Type guard

const trackCreateIsMinimal = (outer: Record<string, unknown>, pd: Record<string, unknown>): boolean =>
  pd.existing_agent_id === undefined || !("description" in outer);

Prevention

When it happens

Trigger: POST /deployments with description set on the outer request body while provider_data.existing_agent_id is present.

Common situations: 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.

Related errors


AI-assisted analysis of langflow-ai/langflow@976ec789d2 (2026-08-14). Data as JSON: /api/errors/21fffe049f420043. Report an issue: GitHub.