{"record":{"id":"3c69ded6e5365b31","repo":"Mintplex-Labs/anything-llm","slug":"failed-to-fetch-workspaces","errorCode":null,"errorMessage":"Failed to fetch workspaces","messagePattern":"Failed to fetch workspaces","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"server/endpoints/browserExtension.js","lineNumber":38,"sourceCode":"    \"/browser-extension/check\",\n    [validBrowserExtensionApiKey],\n    async (request, response) => {\n      try {\n        const user = await userFromSession(request, response);\n        const workspaces = multiUserMode(response)\n          ? await Workspace.whereWithUser(user)\n          : await Workspace.where();\n\n        const apiKeyId = response.locals.apiKey.id;\n        response.status(200).json({\n          connected: true,\n          workspaces,\n          apiKeyId,\n        });\n      } catch (error) {\n        console.error(error);\n        response\n          .status(500)\n          .json({ connected: false, error: \"Failed to fetch workspaces\" });\n      }\n    }\n  );\n\n  app.delete(\n    \"/browser-extension/disconnect\",\n    [validBrowserExtensionApiKey],\n    async (_request, response) => {\n      try {\n        const apiKeyId = response.locals.apiKey.id;\n        const { success, error } =\n          await BrowserExtensionApiKey.delete(apiKeyId);\n        if (!success) throw new Error(error);\n        response.status(200).json({ success: true });\n      } catch (error) {\n        console.error(error);\n        response","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/endpoints/browserExtension.js#L20-L56","documentation":"HTTP 500 from GET /api/browser-extension/check, the AnythingLLM browser-extension connectivity probe. It is reached only after validBrowserExtensionApiKey middleware passes, so authentication already succeeded; the failure is inside the handler - resolving the session user (userFromSession) or listing workspaces (Workspace.where / whereWithUser in multi-user mode). The body {connected:false, error:'Failed to fetch workspaces'} deliberately hides the underlying exception.","triggerScenarios":"Extension calls check with a valid key while the database is down/unreachable; multi-user mode enabled but the session user cannot be resolved (expired/cleared session cookie); the workspaces table is locked or corrupted; Prisma connection pool exhausted.","commonSituations":"Server restarted with a missing/unmounted database volume; SQLite database file deleted or locked by another process; mode switch between single- and multi-user invalidating session data; extension holds an old key pointing at a re-provisioned instance.","solutions":["Check the server console - console.error(error) logs the real exception","Verify the database: container/storage mounted, migrations run, disk not full","If multi-user mode toggled recently, re-authenticate in the browser so userFromSession resolves","As a last resort, disconnect the extension and re-connect to mint a fresh API key"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":"function isConnectedPayload(d) { return d?.connected === true && Array.isArray(d.workspaces); }","tryCatchPattern":"try {\n  const d = await checkConnection();\n  if (!isConnectedPayload(d)) throw new Error(d?.error ?? 'check failed');\n} catch (e) {\n  await wait(2000);\n  const retry = await checkConnection(); // DB blips resolve; persistent failure = server-side\n  if (!isConnectedPayload(retry)) reportServerError(retry?.error);\n}","preventionTips":["Keep the AnythingLLM database volume persistent across restarts","Run migrations after upgrades","Re-authenticate the browser session after toggling multi-user mode","Treat connected:false as server health signal, not an auth failure (auth already passed middleware)"],"tags":["anythingllm","browser-extension","http-500","database","connectivity-check"],"backgroundTag":"http-500-internal-server-error","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}