langflow-ai/langflow · error · HTTPException

Version entry not found

Error message

Version entry not found

What it means

404 from GET /flows/{flow_id}/versions/{version_id}: the flow passed the owner check, but get_flow_version_entry_or_raise found no FlowVersion row with that version_id for this user and flow — the domain exception FlowVersionNotFoundError is translated into a generic 'Version entry not found' HTTPException.

Source

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

# TODO: Full-version export endpoint (export flow with all version entries embedded).
# This is planned as a follow-up feature. The per-version export (exporting a single
# version as a standalone flow) is available via the GET /{version_id} endpoint.


@router.get("/{version_id}")
async def get_single_flow_version(
    flow_id: UUID,
    version_id: UUID,
    current_user: CurrentActiveUser,
    session: DbSession,
) -> FlowVersionReadWithData:
    await _get_user_flow(session, flow_id, current_user.id)

    try:
        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

    return _version_to_read_full(entry, strip_keys=True)


# shares FlowVersionRead model with list endpoint (inside FlowVersionListResponse),
# but omits is_deployed field because its not relevant to this endpoint
@router.post("/", status_code=201, response_model_exclude={"is_deployed"})
async def create_snapshot(
    flow_id: UUID,
    current_user: CurrentActiveUser,
    session: DbSession,
    body: FlowVersionCreate | None = None,
) -> FlowVersionRead:
    flow = await _get_user_flow(session, flow_id, current_user.id)
    await ensure_flow_permission(
        current_user,
        FlowAction.WRITE,
        flow_id=flow.id,

View on GitHub (pinned to 976ec789d2)

Solutions

  1. Re-list versions via GET /flows/{flow_id}/versions/ to see which version_ids still exist
  2. If the entry was pruned, snapshot the current flow state again to create a fresh version
  3. Guard client flows that link to a specific version_id with a 404 fallback to the version list

Example fix

// before
const v = await getVersion(flowId, versionId);

// after
const v = await getVersion(flowId, versionId).catch(async (e) => {
  if (e.response?.status === 404) {
    const list = await listVersions(flowId);
    return list.items.at(-1) ?? null; // newest surviving version
  }
  throw e;
});
Defensive patterns

Strategy: fallback

Validate before calling

const { data } = await axios.get(`/api/v1/flows/${flowId}/versions/`);
const exists = data.items.some((v) => v.id === versionId);

Try / catch

catch (e) {
  if (e.response?.status === 404) return listVersions(flowId).then((l) => l.items.at(-1));
  throw e;
}

Prevention

When it happens

Trigger: Requesting a specific version entry that was deleted (explicitly or pruned by the version-retention limit inside create_flow_version_entry), a version belonging to a different flow, or a version id copied from another environment.

Common situations: Version pruning kicked in when many snapshots were created, removing the entry the client still references; parallel tabs holding stale version lists; re-pointing a client at a restored database with different version rows.

Related errors


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