langflow-ai/langflow · error · ValueError

provider_data must include at least one add_flows or upsert_

Error message

provider_data must include at least one add_flows or upsert_tools item for new agent creation.

What it means

Model validator on WatsonxApiDeploymentCreatePayload: a NEW wxO agent must be created with at least one tool — provider_data must contain at least one add_flows or upsert_tools entry (a TODO notes agent creation without tools is not yet supported by the adapter create path). Empty/omitted both raises ValueError and a 422.

Source

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

                msg = "provider_data.existing_agent_id cannot be set to null."
                raise ValueError(msg)
            if len(self.model_fields_set) > 1:
                msg = (
                    "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."
                )
                raise ValueError(msg)
            return self
        if self.display_name is None:
            msg = "provider_data.display_name is required for new agent creation."
            raise ValueError(msg)
        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"}

View on GitHub (pinned to 976ec789d2)

Solutions

  1. Include at least one add_flows entry (flow version + app ids) or one upsert_tools entry in the create payload.
  2. If you want an LLM-only agent, track an existing wxO agent via existing_agent_id instead, or create the agent in wxO directly and then track it.
  3. Disable submit in the UI until at least one flow/tool is selected.

Example fix

// before
{"provider_data": {"display_name": "Bot", "llm": "mistral_large_2"}}
// after
{"provider_data": {"display_name": "Bot", "llm": "mistral_large_2", "upsert_tools": [{"tool_id": "my-tool", "add_app_ids": []}]}}
Defensive patterns

Strategy: validation

Validate before calling

if provider_data.get("existing_agent_id") is None:
    assert provider_data.get("add_flows") or provider_data.get("upsert_tools"), \
        "new agent creation requires at least one add_flows or upsert_tools item"

Type guard

const hasInitialTool = (pd: Record<string, unknown>): boolean =>
  pd.existing_agent_id !== undefined ||
  (Array.isArray(pd.add_flows) && pd.add_flows.length > 0) ||
  (Array.isArray(pd.upsert_tools) && pd.upsert_tools.length > 0);

Prevention

When it happens

Trigger: POST /deployments creating a new agent where provider_data has no add_flows and no upsert_tools items.

Common situations: Trying to create a bare LLM-only agent first and attach flows later; test payloads with just display_name+llm; UI allowing submit with no flows or tools selected.

Related errors


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