langflow-ai/langflow · error · HTTPException

Cannot activate a version with no data

Error message

Cannot activate a version with no data

What it means

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.

Source

Thrown at src/backend/base/langflow/api/v1/flow_version.py:263

    flow = await _get_user_flow(session, flow_id, current_user.id)
    await ensure_flow_permission(
        current_user,
        FlowAction.WRITE,
        flow_id=flow.id,
        flow_user_id=flow.user_id,
        workspace_id=flow.workspace_id,
        folder_id=flow.folder_id,
    )

    # Verify version entry belongs to this flow
    try:
        target_entry = await get_flow_version_entry_or_raise(session, version_id, current_user.id, flow_id=flow_id)
    except FlowVersionNotFoundError as exc:
        raise HTTPException(status_code=404, detail="Version entry not found") from exc

    # Guard against activating a version with no data (check before auto-snapshot)
    if target_entry.data is None:
        raise HTTPException(status_code=400, detail="Cannot activate a version with no data")

    # Capture copies of both data dicts before the savepoint to avoid stale
    # reads if pruning inside create_flow_version_entry deletes old entries.
    try:
        current_data = copy.deepcopy(flow.data) if save_draft else None
        target_data = copy.deepcopy(target_entry.data)
    except Exception as exc:
        raise HTTPException(
            status_code=422,
            detail="Flow data could not be copied. The data may be corrupted.",
        ) from exc

    # Wrap auto-snapshot + flow overwrite in a single savepoint for atomicity.
    # If the flow update fails, the auto-snapshot is also rolled back.
    try:
        async with session.begin_nested():
            if save_draft and current_data is not None:
                await create_flow_version_entry(

View on GitHub (pinned to 976ec789d2)

Solutions

  1. Pick a different version from GET /flows/{flow_id}/versions/ that has data
  2. Repair the NULL row in the database (flow_version.data) from a known-good export, or delete the bad entry
  3. Avoid writing version rows outside create_flow_version_entry

Example fix

-- before: broken row
-- version entry with data = NULL

-- after: repair from a good snapshot
UPDATE flow_version SET data = (SELECT data FROM flow_version WHERE id = '<good_id>')
WHERE id = '<bad_id>';
Defensive patterns

Strategy: validation

Validate before calling

const v = (await axios.get(`/api/v1/flows/${flowId}/versions/${versionId}`)).data;
const hasData = v.data != null; // only activate when true

Try / catch

catch (e) {
  if (e.response?.status === 400 && /no data/.test(e.response.data?.detail)) pickAnotherVersion();
  throw e;
}

Prevention

When it happens

Trigger: 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).

Common situations: Database migrations or manual SQL edits leaving data NULL; version rows created outside the normal create_flow_version_entry path.

Related errors


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