diff --git a/cspell.json b/cspell.json index 16918ff1b3..d8edfdf864 100644 --- a/cspell.json +++ b/cspell.json @@ -28,6 +28,7 @@ "cafs", "camelcase", "canonicalizer", + "cantopen", "canva", "cerbos", "certfile", diff --git a/store/controller/src/storeController/index.ts b/store/controller/src/storeController/index.ts index 751ed81438..fa6b06d5f4 100644 --- a/store/controller/src/storeController/index.ts +++ b/store/controller/src/storeController/index.ts @@ -44,7 +44,7 @@ export function createPackageStore ( ): StoreController { const storeDir = initOpts.storeDir if (!fs.existsSync(path.join(storeDir, 'files'))) { - initStoreDir(storeDir).catch() + initStoreDir(storeDir).catch(() => {}) } const cafs = createCafsStore(storeDir, { cafsLocker: initOpts.cafsLocker, diff --git a/worker/src/start.ts b/worker/src/start.ts index cd93a972d9..784126707a 100644 --- a/worker/src/start.ts +++ b/worker/src/start.ts @@ -276,8 +276,10 @@ function initStore ({ storeDir }: InitStoreMessage): { status: string } { } } } - // Initialize the SQLite index database - getStoreIndex(storeDir) + // The SQLite index database will be initialized lazily by getStoreIndex() + // on the first operation that needs it (e.g., readPkgFromCafs, addFilesFromDir). + // Eagerly opening it here races with the main thread's StoreIndex constructor, + // which can cause SQLITE_CANTOPEN on Windows due to mandatory file locking. return { status: 'success' } }