langflow-ai/langflow · error · ValueError

{info.field_name} cannot be set to null.

Error message

{info.field_name} cannot be set to null.

What it means

Field validator on WatsonxApiDeploymentUpdatePayload: display_name and llm are optional (may be omitted) but must not be explicitly set to null. A JSON null triggers ValueError '{field} cannot be set to null.' and a 422. The API distinguishes 'field absent = no change' from 'field null = invalid'.

Source

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

    llm: NormalizedStr | None = Field(
        default=None,
        description=(
            "Optional provider model identifier to use for the deployment agent. "
            "When omitted, the current model is preserved."
        ),
    )
    connections: list[WatsonxApiKeyValueConnectionPayload] = Field(default_factory=list)
    upsert_flows: list[WatsonxApiUpsertFlowItem] = Field(default_factory=list)
    upsert_tools: list[WatsonxApiUpsertToolItem] = Field(default_factory=list)
    remove_flows: list[UUID] = Field(default_factory=list)
    remove_tools: list[NormalizedStr] = Field(default_factory=list)

    @field_validator("display_name", "llm", mode="before")
    @classmethod
    def reject_null_optional_strings(cls, value: Any, info: ValidationInfo) -> Any:
        if value is None:
            msg = f"{info.field_name} cannot be set to null."
            raise ValueError(msg)
        return value

    @model_validator(mode="after")
    def validate_operation_references(self) -> WatsonxApiDeploymentUpdatePayload:
        _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.upsert_flows, attr_name="add_app_ids")
        referenced_app_ids.update(_collect_api_referenced_app_ids(self.upsert_tools, attr_name="add_app_ids"))
        _validate_api_remove_not_raw(
            operations=self.upsert_flows,
            raw_app_ids=raw_app_ids,
            attr_name="remove_app_ids",
            label="upsert_flows.remove_app_ids",
        )
        _validate_api_remove_not_raw(
            operations=self.upsert_tools,
            raw_app_ids=raw_app_ids,
            attr_name="remove_app_ids",

View on GitHub (pinned to 976ec789d2)

Solutions

  1. Omit the key entirely instead of sending null when you do not want to change display_name or llm.
  2. Configure the client serializer to skip None values (e.g. Pydantic model_dump(exclude_none=True), JSON.stringify with a replacer that drops nulls).
  3. To clear/replace a value, send a real string; null is never a valid value for these fields.

Example fix

// before
{"provider_data": {"display_name": null, "llm": "mistral-large"}}
// after
{"provider_data": {"llm": "mistral-large"}}
Defensive patterns

Strategy: type-guard

Validate before calling

# strip explicit nulls from provider_data before sending
provider_data = {k: v for k, v in provider_data.items() if v is not None}

Type guard

const hasNoNullOptionals = (pd: Record<string, unknown>): boolean =>
  !["display_name", "llm"].some(k => k in pd && pd[k] === null);

Prevention

When it happens

Trigger: PATCH a wxO deployment with provider_data containing "display_name": null or "llm": null (as opposed to leaving the key out).

Common situations: Client serializers that emit nulls for unset fields (e.g. some JSON mappers or dicts with None values); UI state objects where the field is null when untouched; Swagger examples copied with nulls.

Related errors


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