diegosouzapw/OmniRoute · error · Error

Sync failed

Error message

Sync failed

What it means

Generic failure error from the cloud sync scheduler: the internal POST to /api/sync/cloud returned a non-ok status. The thrown message is the bare sentinel "Sync failed"; the response body's error detail is appended when present. It means the server-to-server sync round (config push/token refresh) was rejected upstream.

Solutions

  1. Check the server log/response body for the underlying error detail from /api/sync/cloud
  2. Verify cloud sync is enabled and the cloud endpoint (NEXT_PUBLIC_CLOUD_URL) is reachable
  3. Re-authenticate the cloud token if the failure is 401/403
  4. Retry the scheduler tick after connectivity is restored
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at src/shared/services/cloudSyncScheduler.ts:112 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/9a3db8bcead1e16e. Report an issue: GitHub.

Appendix: source

Thrown at src/shared/services/cloudSyncScheduler.ts:112

  async sync() {
    // Check if cloud is enabled
    const enabled = await isCloudEnabled();
    if (!enabled) {
      return null;
    }

    await this.initializeMachineId();

    // Call internal API route which handles both sync and token update
    const response = await fetch(`${INTERNAL_BASE_URL}/api/sync/cloud`, {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({ machineId: this.machineId, action: "sync" }),
    });

    if (!response.ok) {
      const errorData = await response.json().catch(() => ({}));
      throw new Error(errorData.error || "Sync failed");
    }

    const result = await response.json();
    return result;
  }

  /**
   * Check if scheduler is running
   */
  isRunning() {
    return this.intervalId !== null;
  }
}

// Export a singleton instance if needed
let cloudSyncScheduler: CloudSyncScheduler | null = null;

export async function getCloudSyncScheduler(machineId: string | null = null, intervalMinutes = 15) {

View on GitHub (pinned to a179ffed5b)