{"record":{"id":"32bd905dfd9270cb","repo":"gatsbyjs/gatsby","slug":"lmdb-path-is-not-set","errorCode":null,"errorMessage":"LMDB path is not set!","messagePattern":"LMDB path is not set!","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/gatsby-core-utils/src/utils/get-storage.ts","lineNumber":37,"sourceCode":"      buildId: string\n    },\n    string\n  >\n  mutex: Database<LockStatus, string>\n}\n\nlet databases: ICoreUtilsDatabase | undefined\nlet rootDb: RootDatabase\n\nexport function getDatabaseDir(): string {\n  const rootDir = global.__GATSBY?.root ?? process.cwd()\n  return path.join(rootDir, `.cache`, `data`, `gatsby-core-utils`)\n}\n\nexport function getStorage(fullDbPath: string): ICoreUtilsDatabase {\n  if (!databases) {\n    if (!fullDbPath) {\n      throw new Error(`LMDB path is not set!`)\n    }\n\n    // __GATSBY_OPEN_LMDBS tracks if we already opened given db in this process\n    // In `gatsby serve` case we might try to open it twice - once for engines\n    // and second to get access to `SitePage` nodes (to power trailing slashes\n    // redirect middleware). This ensure there is single instance within a process.\n    // Using more instances seems to cause weird random errors.\n    if (!globalThis.__GATSBY_OPEN_LMDBS) {\n      globalThis.__GATSBY_OPEN_LMDBS = new Map()\n    }\n\n    databases = globalThis.__GATSBY_OPEN_LMDBS.get(fullDbPath)\n\n    if (databases) {\n      return databases\n    }\n\n    const open = getLmdb().open","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/e85d62f1779e353eaac1753211629a26d123e26c/packages/gatsby-core-utils/src/utils/get-storage.ts#L19-L55","documentation":"getStorage lazily initializes the LMDB databases; a falsy fullDbPath means the caller did not provide the database file path (an internal wiring bug in how storage was constructed), so opening LMDB is refused immediately rather than corrupting state with an empty path.","triggerScenarios":"Thrown at packages/gatsby-core-utils/src/utils/get-storage.ts:37 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the caller passes the .cache/data LMDB path built by getDatabaseDir()","Ensure getStorage is only used via the module-level lazy initializers that resolve the db path first"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e85d62f1779e353eaac1753211629a26d123e26c","analyzedAt":"2026-08-26T17:50:09.662Z","contentChangedAt":"2026-08-26T17:50:09.662Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}