langflow-ai/langflow · error · HTTPException

Database error while activating version. Please try again.

Error message

Database error while activating version. Please try again.

What it means

500 from the version-activation endpoint: a SQLAlchemyError other than IntegrityError escaped the savepoint block — connection loss, deadlock, timeout, driver error, or DDL/lock issues during flush. Distinct from the 409: this is an infrastructure/database failure, not a constraint race. The savepoint rollback means no partial activation was committed.

Source

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

                    user_id=current_user.id,
                    data=current_data,
                    description=f"Auto-saved before activating v{target_entry.version_number}",
                )

            flow.data = target_data
            flow.updated_at = datetime.now(timezone.utc)

            session.add(flow)
            await session.flush()
    except FlowVersionError as exc:
        raise _translate_version_error(exc) from exc
    except IntegrityError as exc:
        raise HTTPException(
            status_code=409,
            detail="Could not activate version — the flow was modified concurrently. Please try again.",
        ) from exc
    except SQLAlchemyError as exc:
        raise HTTPException(
            status_code=500,
            detail="Database error while activating version. Please try again.",
        ) from exc

    await logger.adebug("Activated version %s (%s) for flow %s", version_id, f"v{target_entry.version_number}", flow_id)

    return FlowRead.model_validate(flow, from_attributes=True)


@router.delete("/{version_id}", status_code=204)
async def delete_version_entry(
    flow_id: UUID,
    version_id: UUID,
    current_user: CurrentActiveUser,
    session: DbSession,
) -> None:
    flow = await _get_user_flow(session, flow_id, current_user.id)
    await ensure_flow_permission(

View on GitHub (pinned to 976ec789d2)

Solutions

  1. Check the server log for the chained SQLAlchemyError — it names the real failure (disconnected, lock wait timeout, etc.)
  2. Verify database connectivity and pool sizing; look for other long transactions holding locks on flow/flow_version rows
  3. Retry the activation once the database is healthy; the operation is atomic so a retry is safe
Defensive patterns

Strategy: retry

Try / catch

catch (e) {
  if (e.response?.status === 500) return retryWithBackoff(() => activateVersion(flowId, versionId), 3);
  throw e;
}

Prevention

When it happens

Trigger: Thrown at src/backend/base/langflow/api/v1/flow_version.py:302 when the library encounters an invalid state.

Common situations: Database restart/failover mid-request; connection pool exhaustion; long lock waits from another transaction holding the flow row; migrating the DB while the server is live.

Related errors


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