langflow-ai/langflow · error · HTTPException
Share could not be updated: it may conflict with an existing
Error message
Share could not be updated: it may conflict with an existing share.
What it means
Raised by PATCH /api/v1/authz/shares/{share_id} when session.flush() fails after updating the row (e.g. a DB CHECK or unique constraint rejects the new state). The handler rolls back, logs 'authz_share update rejected' server-side, and returns a fixed 409 without schema leakage — the mirror of the create path's 409.
Source
Thrown at src/backend/base/langflow/api/v1/authz_shares.py:441
share_user_id=owner_id,
)
# Validate permission_level (422 before DB CHECK).
try:
row.permission_level = SharePermissionLevel(payload.permission_level).value
except ValueError as exc:
raise HTTPException(
status_code=400,
detail=f"Unknown permission_level {payload.permission_level!r}",
) from exc
session.add(row)
# Rollback + fixed 409 on constraint failure (same as create_share).
try:
await session.flush()
except Exception as exc:
await session.rollback()
logger.warning("authz_share update rejected: %s", exc)
raise HTTPException(
status_code=status.HTTP_409_CONFLICT,
detail="Share could not be updated: it may conflict with an existing share.",
) from exc
await session.refresh(row)
response = (await _serialize_shares(session, [row]))[0]
await session.commit()
await _refresh_policy_for_share(response.scope, response.target_id, op="share:update")
await audit_decision(
user_id=current_user.id,
action="share:update",
obj=f"{response.resource_type}:{response.resource_id}",
result="allow",
details={
"share_id": str(response.id),
"permission_level": response.permission_level,
},View on GitHub (pinned to 976ec789d2)
Solutions
- Re-fetch the share (GET /authz/shares/{id}) and reconcile your intended change against its current state before retrying
- Do not blind-retry the same PATCH on 409 — inspect what conflicts
- Serialize share edits per resource in the client to avoid concurrent conflicting updates
Defensive patterns
Strategy: retry
Validate before calling
async function refreshThenUpdate(shareId: string, level: string) {
const current = await getShare(shareId); // fail fast with 404 if gone
return updateShare(shareId, { permission_level: level });
} Try / catch
try {
await updateShare(shareId, body);
} catch (e) {
if (e.status === 409) {
const fresh = await getShare(shareId);
// reconcile fresh state with intent, then retry ONCE with corrected body
} else throw e;
} Prevention
- Avoid concurrent PATCHes to the same share from multiple clients
- On 409, always re-read the row before retrying — never replay the identical body blindly
When it happens
Trigger: PATCHing a share into a state that duplicates another share row on the same resource/scope/target, or a permission_level that violates a DB CHECK despite passing the enum validation.
Common situations: Concurrent share edits where two requests converge on conflicting states; updating a share whose target/scope was concurrently changed by another admin.
Related errors
- Share could not be created: it may already exist or conflict
- Unknown permission_level {payload.permission_level!r}
- name cannot be null
- permissions cannot be null; pass an empty list to clear
- Name conflict — another role already uses this name
AI-assisted analysis of langflow-ai/langflow@976ec789d2 (2026-08-14).
Data as JSON: /api/errors/ca05edf7253b6d4e.
Report an issue: GitHub.