{"record":{"id":"04fde1199581965a","repo":"diegosouzapw/OmniRoute","slug":"db-periodic-health-check-failed","errorCode":null,"errorMessage":"[DB] Periodic health-check failed:","messagePattern":"\\[DB\\] Periodic health-check failed:","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/lib/db/core.ts","lineNumber":971,"sourceCode":"function startDbHealthCheckScheduler(db: SqliteDatabase) {\n  clearDbHealthCheckScheduler();\n  if (isCloud || isBuildPhase || isAutomatedTestProcess()) return;\n\n  const intervalMs = getDbHealthCheckIntervalMs();\n  if (intervalMs <= 0) return;\n\n  dbHealthCheckTimer = setInterval(() => {\n    try {\n      if (!db.open) return;\n      runDbHealthCheck(db, {\n        autoRepair: true,\n        skipIntegrityCheck: process.env.OMNIROUTE_SKIP_DB_HEALTHCHECK === \"1\",\n        expectedSchemaVersion: \"1\",\n        createBackupBeforeRepair: () => createHealthCheckBackup(db),\n      });\n    } catch (error: unknown) {\n      const message = error instanceof Error ? error.message : String(error);\n      console.warn(\"[DB] Periodic health-check failed:\", message);\n    }\n  }, intervalMs);\n  dbHealthCheckTimer.unref?.();\n}\n\nlet walTruncateTimer: NodeJS.Timeout | null = null;\n\nfunction getWalTruncateIntervalMs(): number {\n  const rawValue = process.env.OMNIROUTE_WAL_TRUNCATE_INTERVAL_MS;\n  if (typeof rawValue === \"string\" && rawValue.trim().length > 0) {\n    const parsed = Number(rawValue);\n    if (Number.isFinite(parsed) && parsed >= 0) {\n      return parsed;\n    }\n  }\n  return 6 * 60 * 60 * 1000;\n}\n","sourceCodeStart":953,"sourceCodeEnd":989,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/db/core.ts#L953-L989","documentation":"The periodic database health-check scheduler (integrity check / auto-repair pass) threw an unexpected exception during one of its interval ticks. The health check for that tick did not complete; the scheduler keeps running and will retry on the next interval. Because autoRepair may be enabled, a mid-repair failure is also possible here.","triggerScenarios":"Thrown at src/lib/db/core.ts:971 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the logged error to see whether integrity check or repair failed","Run a manual integrity check (PRAGMA integrity_check) on the database","Free disk space / clear locks if repair could not write"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}