diegosouzapw/OmniRoute · error

[DB] Periodic WAL truncate failed:

Error message

[DB] Periodic WAL truncate failed:

What it means

Error "[DB] Periodic WAL truncate failed:" thrown in diegosouzapw/OmniRoute.

Source

Thrown at src/lib/db/core.ts:1016

// file itself; only wal_checkpoint(TRUNCATE) does, and a long-running server never closes its DB.
function startWalTruncateScheduler(db: SqliteDatabase) {
  clearWalTruncateScheduler();
  if (isCloud || isBuildPhase || isAutomatedTestProcess()) return;

  const intervalMs = getWalTruncateIntervalMs();
  if (intervalMs <= 0) return;

  walTruncateTimer = setInterval(() => {
    try {
      if (!db.open) return;
      // TRUNCATE waits for readers; under concurrent write load it can no-op without
      // shrinking the file. That is expected — it retries on the next tick.
      if (checkpointDb(db, "TRUNCATE")) {
        console.log("[DB] Periodic SQLite WAL checkpoint completed (TRUNCATE).");
      }
    } catch (error: unknown) {
      const message = error instanceof Error ? error.message : String(error);
      console.warn("[DB] Periodic WAL truncate failed:", message);
    }
  }, intervalMs);
  walTruncateTimer.unref?.();
}

export function runManagedDbHealthCheck(options?: { autoRepair?: boolean }) {
  const db = getDbInstance();
  return runDbHealthCheck(db, {
    autoRepair: options?.autoRepair === true,
    expectedSchemaVersion: "1",
    createBackupBeforeRepair: () => createHealthCheckBackup(db),
  });
}

export function getDbInstance(): SqliteDatabase {
  const existing = getDb();
  if (existing) return existing;

View on GitHub (pinned to a179ffed5b)

When it happens

Trigger: Thrown at src/lib/db/core.ts:1016 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/ce96df1faf058de4. Report an issue: GitHub.