{"record":{"id":"2cf6282d94eef97a","repo":"diegosouzapw/OmniRoute","slug":"mcp-audit-better-sqlite3-binding-unavailable-f","errorCode":null,"errorMessage":"[MCP Audit] better-sqlite3 binding unavailable — fell back to node:sqlite (${nativeMessage.split(\"\\n\")[0]})","messagePattern":"\\[MCP Audit\\] better-sqlite3 binding unavailable — fell back to node:sqlite \\((.+?)\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"open-sse/mcp-server/audit.ts","lineNumber":259,"sourceCode":"  const { DatabaseSync } = (await import(\"node:sqlite\")) as {\n    DatabaseSync: new (p: string) => NodeSqliteDatabase;\n  };\n  return createNodeSqliteAuditAdapter(new DatabaseSync(dbPath));\n}\n\nasync function openFallbackAuditDb(dbPath: string, nativeMessage: string): Promise<AuditDatabase | null> {\n  if (!nodeSqliteFallbackAvailable()) {\n    console.error(\n      `[MCP Audit] better-sqlite3 native binding unavailable and Node ${process.version} ` +\n        \"has no built-in sqlite. Audit logging disabled. Fix: run \" +\n        \"`npm rebuild better-sqlite3` in the omniroute install root.\"\n    );\n    return null;\n  }\n\n  try {\n    const adapter = await openNodeSqliteAuditDb(dbPath);\n    console.warn(\n      `[MCP Audit] better-sqlite3 binding unavailable — fell back to node:sqlite ` +\n        `(${nativeMessage.split(\"\\n\")[0]})`\n    );\n    return adapter;\n  } catch (nodeErr) {\n    const nodeMessage = nodeErr instanceof Error ? nodeErr.message : String(nodeErr);\n    console.error(\"[MCP Audit] Failed to connect to database:\", nodeMessage);\n    return null;\n  }\n}\n\n/**\n * Lazy-load the database connection.\n * Uses the same SQLite database as the main OmniRoute app.\n *\n * Driver priority:\n *   1. better-sqlite3 — fast native binding (when its compiled `.node`\n *      binary is present, see scripts/build/postinstall.mjs).","sourceCodeStart":241,"sourceCodeEnd":277,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/open-sse/mcp-server/audit.ts#L241-L277","documentation":"Error \"[MCP Audit] better-sqlite3 binding unavailable — fell back to node:sqlite (${nativeMessage.split(\"\\n\")[0]})\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at open-sse/mcp-server/audit.ts:259 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}