langflow-ai/langflow · error · ValueError

provider_data.llm is required for new agent creation.

Error message

provider_data.llm is required for new agent creation.

What it means

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.

Source

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

    @model_validator(mode="after")
    def validate_create_operation_requirements(self) -> WatsonxApiDeploymentCreatePayload:
        if "existing_agent_id" in self.model_fields_set:
            if self.existing_agent_id is None:
                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)

View on GitHub (pinned to 976ec789d2)

Solutions

  1. Set provider_data.llm to a valid wxO model id (e.g. 'mistral_large_2' per your wxO tenant's catalog).
  2. Make the model field required in the client form before submit.
  3. Verify the model id against the wxO instance — an invalid id will fail later at the provider even if present.

Example fix

// before
{"provider_data": {"display_name": "Bot", "add_flows": [...]}}
// after
{"provider_data": {"display_name": "Bot", "llm": "mistral_large_2", "add_flows": [...]}}
Defensive patterns

Strategy: validation

Validate before calling

if provider_data.get("existing_agent_id") is None:
    assert provider_data.get("llm", "").strip(), "llm required for new agent creation"

Type guard

const hasCreateLlm = (pd: Record<string, unknown>): boolean =>
  pd.existing_agent_id !== undefined || (typeof pd.llm === "string" && pd.llm.trim().length > 0);

Prevention

When it happens

Trigger: POST /deployments creating a new agent where provider_data omits llm (and existing_agent_id is not used).

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

Related errors


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