{"record":{"id":"3d3a7c8c300ffed4","repo":"diegosouzapw/OmniRoute","slug":"db-nenhum-driver-sqlite-dispon-vel-para-sqlit-3d3a7c","errorCode":null,"errorMessage":"[DB] Nenhum driver SQLite disponível para '${sqliteFile}'. Chame ensureDbInitialized() no startup. Drivers testados: ${syncDrivers}. sql.js WASM ainda não foi pré-inicializado.","messagePattern":"\\[DB\\] Nenhum driver SQLite disponível para '(.+?)'\\. Chame ensureDbInitialized\\(\\) no startup\\. Drivers testados: (.+?)\\. sql\\.js WASM ainda não foi pré-inicializado\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/lib/db/core.ts","lineNumber":214,"sourceCode":"  const sqlJs = getSqlJsAdapter(sqliteFile);\n  if (sqlJs) return sqlJs;\n\n  // sql.js pre-init was genuinely attempted (e.g. by the top-level eager\n  // barrier below) and failed — surface the real cause instead of the\n  // generic/misleading \"not pre-initialized yet\" message (#7288).\n  const preInitError = getSqlJsPreInitError(sqliteFile);\n  const syncDrivers = process.versions.bun\n    ? \"bun:sqlite (failed)\"\n    : \"better-sqlite3 (failed), node:sqlite (unavailable)\";\n  if (preInitError) {\n    throw new Error(\n      `[DB] Nenhum driver SQLite disponível para '${sqliteFile}'. ` +\n        `Drivers testados: ${syncDrivers}, ` +\n        `sql.js (falhou: ${preInitError}).`\n    );\n  }\n\n  throw new Error(\n    `[DB] Nenhum driver SQLite disponível para '${sqliteFile}'. ` +\n      \"Chame ensureDbInitialized() no startup. \" +\n      `Drivers testados: ${syncDrivers}. ` +\n      \"sql.js WASM ainda não foi pré-inicializado.\"\n  );\n}\n\n// Ensure data directory exists — with fallback for restricted home directories (#133)\nif (!isCloud && !fs.existsSync(DATA_DIR)) {\n  try {\n    fs.mkdirSync(DATA_DIR, { recursive: true });\n  } catch (err: unknown) {\n    const msg = err instanceof Error ? err.message : String(err);\n    console.warn(\n      `[DB] Cannot create data directory '${DATA_DIR}': ${msg}\\n` +\n        `[DB] Set the DATA_DIR environment variable to a writable path, e.g.:\\n` +\n        `[DB]   DATA_DIR=/path/to/writable/dir omniroute`\n    );","sourceCodeStart":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/db/core.ts#L196-L232","documentation":"Error \"[DB] Nenhum driver SQLite disponível para '${sqliteFile}'. Chame ensureDbInitialized() no startup. Drivers testados: ${syncDrivers}. sql.js WASM ainda não foi pré-inicializado.\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/lib/db/core.ts:214 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"}