diegosouzapw/OmniRoute · error

[COMPLIANCE] Could not initialize audit log:

Error message

[COMPLIANCE] Could not initialize audit log:

What it means

Startup warning from the compliance bootstrap in instrumentation-node: dynamically importing/initializing the audit log (initAuditLog + cleanupExpiredLogs) threw, and the message is logged non-fatally — the server continues booting but audit logging/expiry cleanup may be inactive for the session.

Solutions

  1. Check DB write permissions for the audit table
  2. Restart to retry initialization
  3. Verify retention settings if cleanup keeps failing
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/instrumentation-node.ts:503 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/e740afe9122c4072. Report an issue: GitHub.

Appendix: source

Thrown at src/instrumentation-node.ts:503

  try {
    const { initAuditLog, cleanupExpiredLogs } = await import("@/lib/compliance/index");
    initAuditLog();
    console.log("[COMPLIANCE] Audit log table initialized");

    const cleanup = await cleanupExpiredLogs();
    if (
      cleanup.deletedUsage ||
      cleanup.deletedCallLogs ||
      cleanup.deletedProxyLogs ||
      cleanup.deletedRequestDetailLogs ||
      cleanup.deletedAuditLogs ||
      cleanup.deletedMcpAuditLogs
    ) {
      console.log("[COMPLIANCE] Expired log cleanup:", cleanup);
    }
  } catch (err: unknown) {
    const msg = err instanceof Error ? err.message : String(err);
    console.warn("[COMPLIANCE] Could not initialize audit log:", msg);
  }

  // Storage-configured scheduled VACUUM (#4437): registers the timer from
  // Settings > System & Storage and persists lastVacuumAt for the UI.
  try {
    const { initVacuumScheduler } = await import("@/lib/db/vacuumScheduler");
    initVacuumScheduler();
    console.log("[STARTUP] Scheduled VACUUM initialized (#4437)");
  } catch (err: unknown) {
    const msg = err instanceof Error ? err.message : String(err);
    console.warn("[STARTUP] Could not initialize vacuum scheduler (non-fatal):", msg);
  }

  // Retention cleanup scheduler (#4691/#6988, #9624): runs the general retention
  // cleanup once after startup and then every 6 hours. Previously this was only
  // wired into the unused src/server-init.ts, so telemetry tables grew unboundedly
  // even with retention.autoCleanupEnabled=true. Idempotent (guarded internally).
  try {

View on GitHub (pinned to a179ffed5b)