diegosouzapw/OmniRoute · error · SettingsRevisionConflictError
SETTINGS_REVISION_CONFLICT
SETTINGS_REVISION_CONFLICT
Error message
Settings changed since this snapshot; refresh and retry
What it means
Optimistic-concurrency check on the settings write: updateSettings threw SettingsRevisionConflictError because the stored settings revision no longer matches the expectedRevision the client read. Another writer changed settings in between; the failure is audited and the client must refresh and replay its change.
Solutions
- Refresh the settings view to get the latest revision and re-apply the change
- Re-read expectedRevision before retrying the PATCH
- Coordinate with other administrators making concurrent edits
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at src/app/api/settings/route.ts:447 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25).
Data as JSON: /api/errors/6a609371a1353743.
Report an issue: GitHub.
Appendix: source
Thrown at src/app/api/settings/route.ts:447
if (body.newPassword) {
body.password = await hashManagementPassword(body.newPassword);
delete body.newPassword;
}
delete body.currentPassword;
delete body.expectedRevision;
// Snapshot BEFORE the write so the success row can record a real diff.
const beforeSnapshot = (await getSettings()) as Record<string, unknown>;
let settings: Awaited<ReturnType<typeof getSettings>>;
try {
settings = await updateSettings(body, { expectedRevision });
} catch (error) {
if (error instanceof SettingsRevisionConflictError) {
emitSettingsFailureAudit(request, actor, "SETTINGS_REVISION_CONFLICT", attemptedKeys);
return NextResponse.json(
{
error: {
code: "SETTINGS_REVISION_CONFLICT",
message: "Settings changed since this snapshot; refresh and retry",
currentRevision: error.currentRevision,
},
},
{ status: 409, headers: settingsResponseHeaders(error.currentRevision) }
);
}
throw error;
}
// Sync CLIProxyAPI settings to upstream_proxy_config table
const cpaUrl = rawBody.cliproxyapi_url as string | undefined;
const cpaFallback = rawBody.cliproxyapi_fallback_enabled as boolean | undefined;
if (cpaUrl && typeof cpaUrl === "string") {
const urlValidation = validateProxyUrl(cpaUrl);
if (urlValidation.valid === false) {
emitSettingsFailureAudit(request, actor, "CLIPROXY_URL_INVALID", attemptedKeys);
return NextResponse.json(View on GitHub (pinned to a179ffed5b)