{"record":{"id":"45e8818e7241f1b4","repo":"Mintplex-Labs/anything-llm","slug":"error-message-45e881","errorCode":null,"errorMessage":"${error.message}","messagePattern":"\\$\\{error\\.message\\}","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"server/endpoints/communityHub.js","lineNumber":28,"sourceCode":"const { Telemetry } = require(\"../models/telemetry\");\nconst {\n  flexUserRoleValid,\n  ROLES,\n} = require(\"../utils/middleware/multiUserProtected\");\n\nfunction communityHubEndpoints(app) {\n  if (!app) return;\n\n  app.get(\n    \"/community-hub/settings\",\n    [validatedRequest, flexUserRoleValid([ROLES.admin])],\n    async (_, response) => {\n      try {\n        const { connectionKey } = await SystemSettings.hubSettings();\n        response.status(200).json({ success: true, connectionKey });\n      } catch (error) {\n        console.error(error);\n        response.status(500).json({ success: false, error: error.message });\n      }\n    }\n  );\n\n  app.post(\n    \"/community-hub/settings\",\n    [validatedRequest, flexUserRoleValid([ROLES.admin])],\n    async (request, response) => {\n      try {\n        const data = reqBody(request);\n        const result = await SystemSettings.updateSettings(data);\n        if (result.error) throw new Error(result.error);\n        response.status(200).json({ success: true, error: null });\n      } catch (error) {\n        console.error(error);\n        response.status(500).json({ success: false, error: error.message });\n      }\n    }","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/endpoints/communityHub.js#L10-L46","documentation":"Pass-through of error.message from GET /community-hub/settings (admin only). The try block only awaits SystemSettings.hubSettings(), which reads hub config from the system_settings table - no network call happens on this route. A 500 here therefore means the settings read threw: DB locked/missing table, or a malformed settings row that breaks parsing.","triggerScenarios":"system_settings table missing after a broken migration; SQLITE_BUSY from a concurrent write; corrupted/malformed hub settings row (e.g. hand-edited JSON) that throws during parse.","commonSituations":"Instances upgraded with interrupted migrations; direct DB edits; volume permission changes.","solutions":["Read the returned error.message and server logs - it names the settings-layer failure.","Restart the server so boot migrations/validation re-run.","If a bad settings row is implicated, clear the community hub keys in system_settings and re-save them from the UI."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { const { connectionKey } = await getHubSettings(); }\ncatch (e) {\n  if (e.status === 500) throw new Error('Hub settings unreadable - DB layer failure, check server logs');\n  if (e.status === 401 || e.status === 403) throw new Error('Admin session required');\n  throw e;\n}","preventionTips":["Run migrations to completion after upgrades.","Avoid direct hand-edits of the system_settings table."],"tags":["community-hub","settings","http-500","sqlite"],"backgroundTag":"database-query-failed","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}