{"record":{"id":"9945f9d6586e83bb","repo":"langflow-ai/langflow","slug":"cannot-activate-a-version-with-no-data","errorCode":null,"errorMessage":"Cannot activate a version with no data","messagePattern":"Cannot activate a version with no data","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"src/backend/base/langflow/api/v1/flow_version.py","lineNumber":263,"sourceCode":"    flow = await _get_user_flow(session, flow_id, current_user.id)\n    await ensure_flow_permission(\n        current_user,\n        FlowAction.WRITE,\n        flow_id=flow.id,\n        flow_user_id=flow.user_id,\n        workspace_id=flow.workspace_id,\n        folder_id=flow.folder_id,\n    )\n\n    # Verify version entry belongs to this flow\n    try:\n        target_entry = await get_flow_version_entry_or_raise(session, version_id, current_user.id, flow_id=flow_id)\n    except FlowVersionNotFoundError as exc:\n        raise HTTPException(status_code=404, detail=\"Version entry not found\") from exc\n\n    # Guard against activating a version with no data (check before auto-snapshot)\n    if target_entry.data is None:\n        raise HTTPException(status_code=400, detail=\"Cannot activate a version with no data\")\n\n    # Capture copies of both data dicts before the savepoint to avoid stale\n    # reads if pruning inside create_flow_version_entry deletes old entries.\n    try:\n        current_data = copy.deepcopy(flow.data) if save_draft else None\n        target_data = copy.deepcopy(target_entry.data)\n    except Exception as exc:\n        raise HTTPException(\n            status_code=422,\n            detail=\"Flow data could not be copied. The data may be corrupted.\",\n        ) from exc\n\n    # Wrap auto-snapshot + flow overwrite in a single savepoint for atomicity.\n    # If the flow update fails, the auto-snapshot is also rolled back.\n    try:\n        async with session.begin_nested():\n            if save_draft and current_data is not None:\n                await create_flow_version_entry(","sourceCodeStart":245,"sourceCodeEnd":281,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/src/backend/base/langflow/api/v1/flow_version.py#L245-L281","documentation":"400 from the version-activation endpoint: the target version entry exists but its data column is NULL. The guard fires before any auto-snapshot or flow overwrite, because activating a dataless version would blank the flow or violate constraints downstream. Entries normally always carry data; NULL indicates a stripped or partially-created row.","triggerScenarios":"Activating a version whose row was created with data=NULL — e.g. rows written by external tooling, restored from a partial dump, or created by an older/experimental code path that allowed null data (note the API strips data for some reads via strip_version_data, but this checks the DB value itself).","commonSituations":"Database migrations or manual SQL edits leaving data NULL; version rows created outside the normal create_flow_version_entry path.","solutions":["Pick a different version from GET /flows/{flow_id}/versions/ that has data","Repair the NULL row in the database (flow_version.data) from a known-good export, or delete the bad entry","Avoid writing version rows outside create_flow_version_entry"],"exampleFix":"-- before: broken row\n-- version entry with data = NULL\n\n-- after: repair from a good snapshot\nUPDATE flow_version SET data = (SELECT data FROM flow_version WHERE id = '<good_id>')\nWHERE id = '<bad_id>';","handlingStrategy":"validation","validationCode":"const v = (await axios.get(`/api/v1/flows/${flowId}/versions/${versionId}`)).data;\nconst hasData = v.data != null; // only activate when true","typeGuard":null,"tryCatchPattern":"catch (e) {\n  if (e.response?.status === 400 && /no data/.test(e.response.data?.detail)) pickAnotherVersion();\n  throw e;\n}","preventionTips":["Filter dataless versions out of the activation UI","Only create version rows through the versioning API so data is always populated","Audit restored databases for NULL data columns in flow_version"],"tags":["http-400","flow-versions","activate","data-integrity"],"backgroundTag":null,"analyzedSha":"976ec789d2886a86de109c044d089d68e96c9a35","analyzedAt":"2026-08-14T18:23:12.227Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}