diegosouzapw/OmniRoute · error
Sync server
Error message
Sync server ${res.status}: ${body} What it means
Generic request() wrapper inside createSyncServerClient: the sync server answered with a non-2xx status; the raw status and response body are wrapped in a plain Error. Fires for any sync-server HTTP failure (auth, 404, 5xx) during sync operations.
Solutions
- Check the sync token is valid and not revoked
- Inspect the status/body in the message for the actual server cause
- Retry later if the status is 5xx (server-side issue)
- Verify the sync server base URL is reachable
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at src/lib/obsidian/api.ts:366 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/e53509158433f479.
Report an issue: GitHub.
Appendix: source
Thrown at src/lib/obsidian/api.ts:366
conflictPath: string;
detectedAt: number;
}
export function createSyncServerClient(syncToken: string, baseUrl?: string) {
const resolvedBaseUrl = baseUrl ?? DEFAULT_SYNC_SERVER_URL;
async function request<T>(path: string, init?: RequestInit): Promise<T> {
const res = await fetch(`${resolvedBaseUrl}${path}`, {
...init,
headers: {
"Content-Type": "application/json",
...(syncToken ? { Authorization: `Bearer ${syncToken}` } : {}),
...init?.headers,
},
});
if (!res.ok) {
const body = await res.text();
throw new Error(`Sync server ${res.status}: ${body}`);
}
return res.json() as Promise<T>;
}
return {
async getStatus(): Promise<SyncServerStatus> {
return request<SyncServerStatus>("/vault/sync/status");
},
async triggerSync(): Promise<{ ok: boolean; pulled: number; pushed: number; deleted: number; conflicts: number }> {
return request("/vault/sync/trigger", { method: "POST" });
},
async getConflicts(): Promise<{ conflicts: SyncConflict[] }> {
return request("/vault/sync/conflicts");
},
async resolveConflict(path: string, resolution: "local" | "remote" | "keep-both"): Promise<unknown> {
return request("/vault/sync/resolve", {
method: "POST",
body: JSON.stringify({ path, resolution }),View on GitHub (pinned to a179ffed5b)