{"record":{"id":"9a3adb46391e3a68","repo":"langflow-ai/langflow","slug":"flow-version-flow-version-id-cannot-be-used-as","errorCode":null,"errorMessage":"Flow version '{flow_version.id}' cannot be used as a deployment artifact: {exc.errors()[0]['msg']}","messagePattern":"Flow version '(.+?)' cannot be used as a deployment artifact: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":422,"severity":"warning","filePath":"src/backend/base/langflow/api/v1/mappers/deployments/base.py","lineNumber":261,"sourceCode":"\n        flow_name = getattr(flow_row, \"name\", None) or \"\"\n        if not flow_name:\n            raise HTTPException(\n                status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,\n                detail=(\n                    f\"Cannot build deployment artifact: the parent flow for version \"\n                    f\"'{flow_version.id}' has been deleted or has no name.\"\n                ),\n            )\n        try:\n            return BaseFlowArtifact(\n                id=flow_version.flow_id,\n                name=flow_name,\n                description=getattr(flow_row, \"description\", None),\n                data=flow_version.data,\n            )\n        except ValidationError as exc:\n            raise HTTPException(\n                status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,\n                detail=(\n                    f\"Flow version '{flow_version.id}' cannot be used as a deployment \"\n                    f\"artifact: {exc.errors()[0]['msg']}\"\n                ),\n            ) from exc\n\n    async def resolve_deployment_list_adapter_params(\n        self,\n        *,\n        deployment_type: DeploymentType | None,\n        provider_params: dict[str, Any] | None,\n    ) -> DeploymentListParams | None:\n        if deployment_type is None and provider_params is None:\n            return None\n        return DeploymentListParams(\n            deployment_types=[deployment_type] if deployment_type is not None else None,\n            provider_params=provider_params,","sourceCodeStart":243,"sourceCodeEnd":279,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/src/backend/base/langflow/api/v1/mappers/deployments/base.py#L243-L279","documentation":"422 from the base deployment mapper when BaseFlowArtifact construction raises pydantic ValidationError — the flow version's data does not satisfy the artifact schema (e.g. data is not valid flow JSON, required fields wrong types). The first validation error message is surfaced (exc.errors()[0]['msg']) prefixed by the version id, so the caller sees exactly which constraint failed.","triggerScenarios":"Deploying a flow version whose stored `data` is null, malformed, or schema-incompatible — corrupted saves, versions written by an older/newer Langflow with a different artifact schema, or hand-edited DB rows.","commonSituations":"Upgrading Langflow changes BaseFlowArtifact validation rules and old versions no longer parse; flow JSON truncated during a failed save; importing a flow from another instance.","solutions":["Read the surfaced validation msg — it names the failing field/constraint","Open the flow in the editor and re-save to rewrite clean version data, then re-deploy","If version data is unrecoverable, create a new version from the current flow state"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"from langflow.api.v1.mappers.deployments.base import BaseFlowArtifact\nBaseFlowArtifact.model_validate({\"id\": fv[\"flow_id\"], \"name\": name, \"data\": fv[\"data\"]})  # dry-run locally","typeGuard":null,"tryCatchPattern":"try:\n    await create_deployment(client, version_id)\nexcept httpx.HTTPStatusError as e:\n    if e.response.status_code == 422 and \"cannot be used as a deployment artifact\" in e.response.json()[\"detail\"]:\n        version = await resave_flow_new_version(client, flow_id)  # rewrite clean data\n        await create_deployment(client, version.id)\n    else:\n        raise","preventionTips":["Re-save flows in the editor after major Langflow upgrades before deploying old versions","Read the surfaced pydantic msg — it names the failing field","Validate version data against BaseFlowArtifact before automating deployments"],"tags":["deployment","flow-version","pydantic","http-422","langflow"],"backgroundTag":null,"analyzedSha":"976ec789d2886a86de109c044d089d68e96c9a35","analyzedAt":"2026-08-14T18:23:12.227Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}