{"record":{"id":"2a13d3223ee397d8","repo":"stablyai/orca","slug":"chromium-cookies-database-changed-while-creating-a","errorCode":null,"errorMessage":"Chromium cookies database changed while creating a snapshot","messagePattern":"Chromium cookies database changed while creating a snapshot","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"src/main/browser/chromium-cookie-snapshot.ts","lineNumber":138,"sourceCode":"export function createChromiumCookieSnapshot(\n  sourcePath: string,\n  options: ChromiumCookieSnapshotOptions = {}\n): ChromiumCookieSnapshot {\n  const snapshotDir = mkdtempSync(join(options.tempRoot ?? tmpdir(), 'orca-cookie-import-'))\n  const databasePath = join(snapshotDir, 'Cookies')\n  let keepSnapshot = false\n\n  try {\n    for (let attempt = 0; attempt < SNAPSHOT_ATTEMPTS; attempt += 1) {\n      if (copyStableAttempt(sourcePath, databasePath)) {\n        keepSnapshot = true\n        return {\n          databasePath,\n          cleanup: () => removeSnapshotDirectory(snapshotDir)\n        }\n      }\n    }\n    throw new Error('Chromium cookies database changed while creating a snapshot')\n  } finally {\n    if (!keepSnapshot) {\n      removeSnapshotDirectory(snapshotDir)\n    }\n  }\n}\n","sourceCodeStart":120,"sourceCodeEnd":145,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/browser/chromium-cookie-snapshot.ts#L120-L145","documentation":"Thrown by createChromiumCookieSnapshot() after SNAPSHOT_ATTEMPTS (5) consecutive copyStableAttempt() calls returned false. Each attempt re-stats the source database/WAL before and after the copyFile; if the size/inode/mtime changed mid-copy (Chromium is actively writing), the attempt is discarded as inconsistent. Five failures means the browser was too busy to produce a quiescent snapshot.","triggerScenarios":"The live Chromium process is continuously writing to its Cookies SQLite database (active sync, heavy browsing, download of a large cookie set) so every copy observes a before/after mismatch within the 5-attempt budget.","commonSituations":"Importing cookies while the browser is actively syncing or the user is logged into many Google services. Snapshotting during a page load that sets many cookies. Disk that is too slow to complete a consistent copy between Chromium write ticks.","solutions":["Close or pause the source browser so it stops writing to the Cookies DB, then retry.","Increase SNAPSHOT_ATTEMPTS if the environment has a slow or contended disk.","Retry the whole createChromiumCookieSnapshot call with backoff — churn is often transient.","On Windows, ensure AV/EDR is not briefly locking the file (copyFileWithWindowsRetry already mitigates EBUSY but adds latency)."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"for (let i = 0; i < 3; i++) {\n  try {\n    return createChromiumCookieSnapshot(sourcePath)\n  } catch (error) {\n    if (error instanceof Error && error.message.includes('changed while creating')) {\n      await new Promise(r => setTimeout(r, 200 * (i + 1)))\n      continue\n    }\n    throw error\n  }\n}","preventionTips":["Close or quiesce the source browser before snapshotting to eliminate write churn.","Retry with backoff since cookie churn is transient.","Increase SNAPSHOT_ATTEMPTS for environments with contended disks.","Avoid snapshotting during heavy browsing/sync activity."],"tags":["chromium","cookies","sqlite","snapshot","concurrency","retry"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}