{"record":{"id":"32d91226dc217099","repo":"diegosouzapw/OmniRoute","slug":"unable-to-inspect-existing-database-at-dbpath","errorCode":null,"errorMessage":"Unable to inspect existing database at ${dbPath}: ${message}","messagePattern":"Unable to inspect existing database at (.+?): (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"electron/sqlite-inspection.js","lineNumber":55,"sourceCode":"\n  let db = null;\n  try {\n    db = openDatabase(dbPath);\n    const row = db\n      .prepare(\n        `SELECT 1\n           FROM provider_connections\n          WHERE access_token LIKE 'enc:v1:%'\n             OR refresh_token LIKE 'enc:v1:%'\n             OR api_key LIKE 'enc:v1:%'\n             OR id_token LIKE 'enc:v1:%'\n          LIMIT 1`\n      )\n      .get();\n    return !!row;\n  } catch (error) {\n    const message = formatLoadError(error);\n    throw new Error(`Unable to inspect existing database at ${dbPath}: ${message}`);\n  } finally {\n    if (db) {\n      db.close();\n    }\n  }\n}\n\nmodule.exports = {\n  hasEncryptedCredentials,\n  openNodeSqliteReadOnly,\n  openReadOnlySqliteDatabase,\n};\n","sourceCodeStart":37,"sourceCodeEnd":68,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/electron/sqlite-inspection.js#L37-L68","documentation":"Thrown by hasEncryptedCredentials() in the Electron SQLite inspection preflight when better-sqlite3 cannot open or query the provider_connections table at the given dbPath — the underlying open()/prepare() failure (locked database, corrupted file, missing table, permission error) is normalized by formatLoadError and embedded in the message. The caller (startNextServer) uses this result to decide whether encrypted credentials can be migrated, so an unopenable database aborts that decision, not the whole startup.","triggerScenarios":"Thrown at electron/sqlite-inspection.js:55 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify dbPath points to the real OmniRoute SQLite file (default under ~/.omniroute/) and that the Electron process has read permission","Ensure no other process holds an exclusive lock; close running OmniRoute server instances or retry after they exit","If the file is corrupted, restore from backup or delete it so a fresh schema is created on next start","Update/rebuild better-sqlite3 so its ABI matches the running Electron Node version"],"exampleFix":null,"handlingStrategy":"try-catch","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"}