langflow-ai/langflow · error · HTTPException
Could not activate version — the flow was modified concurren
Error message
Could not activate version — the flow was modified concurrently. Please try again.
What it means
409 from the version-activation endpoint: inside the begin_nested savepoint, session.flush() raised SQLAlchemy IntegrityError — a database-level unique/constraint violation while writing the auto-snapshot row or the updated flow. The message frames it as concurrent modification because the most common IntegrityError here is a version-number unique collision caused by a race, and the savepoint rolls everything back atomically.
Source
Thrown at src/backend/base/langflow/api/v1/flow_version.py:297
async with session.begin_nested():
if save_draft and current_data is not None:
await create_flow_version_entry(
session,
flow_id=flow.id,
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,View on GitHub (pinned to 976ec789d2)
Solutions
- Retry the activation after a short delay — one of the racing requests wins and the retry then targets a consistent state
- Debounce/disable the activate button client-side to prevent duplicate submits
- If it persists single-threaded, check the server log for the underlying IntegrityError and the constraint it names (could be a schema/unique-index drift after migrations)
Example fix
// before
await activateVersion(flowId, versionId);
// after: single retry with backoff for 409
for (let attempt = 0; attempt < 2; attempt++) {
try {
await activateVersion(flowId, versionId);
break;
} catch (e) {
if (e.response?.status !== 409 || attempt === 1) throw e;
await sleep(500);
}
} Defensive patterns
Strategy: retry
Try / catch
catch (e) {
if (e.response?.status === 409) { await sleep(backoffMs); return activateVersion(flowId, versionId); }
throw e;
} Prevention
- Debounce activate buttons and disable during in-flight requests
- Use idempotency-style single-flight wrappers for activation calls
- Cap retries (1-2) and surface persistent 409s instead of looping
When it happens
Trigger: Two concurrent activations (or activation + snapshot creation) on the same flow racing to claim the next version_number; the flow row failing an optimistic-concurrency/unique constraint at flush time. The savepoint guarantees neither the auto-snapshot nor the flow overwrite persists.
Common situations: Double-clicked 'activate' in the UI firing two identical requests; automation retrying activation without backoff; multiple clients editing the same flow.
Related errors
- Database error while activating version. Please try again.
- Cannot activate a version with no data
- Flow data could not be copied. The data may be corrupted.
- Could not create default folder.
- Flow creation failed.
AI-assisted analysis of langflow-ai/langflow@976ec789d2 (2026-08-14).
Data as JSON: /api/errors/3ca84f1f003a3b24.
Report an issue: GitHub.