{"record":{"id":"e4a2ea7c5350be2f","repo":"langflow-ai/langflow","slug":"info-field-name-cannot-be-set-to-null","errorCode":null,"errorMessage":"{info.field_name} cannot be set to null.","messagePattern":"(.+?) cannot be set to null\\.","errorType":"validation","errorClass":"ValueError","httpStatus":422,"severity":"error","filePath":"src/backend/base/langflow/api/v1/mappers/deployments/watsonx_orchestrate/payloads.py","lineNumber":299,"sourceCode":"    llm: NormalizedStr | None = Field(\n        default=None,\n        description=(\n            \"Optional provider model identifier to use for the deployment agent. \"\n            \"When omitted, the current model is preserved.\"\n        ),\n    )\n    connections: list[WatsonxApiKeyValueConnectionPayload] = Field(default_factory=list)\n    upsert_flows: list[WatsonxApiUpsertFlowItem] = Field(default_factory=list)\n    upsert_tools: list[WatsonxApiUpsertToolItem] = Field(default_factory=list)\n    remove_flows: list[UUID] = Field(default_factory=list)\n    remove_tools: list[NormalizedStr] = Field(default_factory=list)\n\n    @field_validator(\"display_name\", \"llm\", mode=\"before\")\n    @classmethod\n    def reject_null_optional_strings(cls, value: Any, info: ValidationInfo) -> Any:\n        if value is None:\n            msg = f\"{info.field_name} cannot be set to null.\"\n            raise ValueError(msg)\n        return value\n\n    @model_validator(mode=\"after\")\n    def validate_operation_references(self) -> WatsonxApiDeploymentUpdatePayload:\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.upsert_flows, attr_name=\"add_app_ids\")\n        referenced_app_ids.update(_collect_api_referenced_app_ids(self.upsert_tools, attr_name=\"add_app_ids\"))\n        _validate_api_remove_not_raw(\n            operations=self.upsert_flows,\n            raw_app_ids=raw_app_ids,\n            attr_name=\"remove_app_ids\",\n            label=\"upsert_flows.remove_app_ids\",\n        )\n        _validate_api_remove_not_raw(\n            operations=self.upsert_tools,\n            raw_app_ids=raw_app_ids,\n            attr_name=\"remove_app_ids\",","sourceCodeStart":281,"sourceCodeEnd":317,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/src/backend/base/langflow/api/v1/mappers/deployments/watsonx_orchestrate/payloads.py#L281-L317","documentation":"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'.","triggerScenarios":"PATCH a wxO deployment with provider_data containing \"display_name\": null or \"llm\": null (as opposed to leaving the key out).","commonSituations":"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.","solutions":["Omit the key entirely instead of sending null when you do not want to change display_name or llm.","Configure the client serializer to skip None values (e.g. Pydantic model_dump(exclude_none=True), JSON.stringify with a replacer that drops nulls).","To clear/replace a value, send a real string; null is never a valid value for these fields."],"exampleFix":"// before\n{\"provider_data\": {\"display_name\": null, \"llm\": \"mistral-large\"}}\n// after\n{\"provider_data\": {\"llm\": \"mistral-large\"}}","handlingStrategy":"type-guard","validationCode":"# strip explicit nulls from provider_data before sending\nprovider_data = {k: v for k, v in provider_data.items() if v is not None}","typeGuard":"const hasNoNullOptionals = (pd: Record<string, unknown>): boolean =>\n  ![\"display_name\", \"llm\"].some(k => k in pd && pd[k] === null);","tryCatchPattern":null,"preventionTips":["Serialize optional fields with exclude_none / drop nulls.","Remember the contract: absent = no change; null = invalid.","Add a linter/test asserting the request builder never emits nulls for these keys."],"tags":["watsonx-orchestrate","pydantic","validation","http-422","null-handling"],"backgroundTag":null,"analyzedSha":"976ec789d2886a86de109c044d089d68e96c9a35","analyzedAt":"2026-08-14T18:23:12.227Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}