Mintplex-Labs/anything-llm · error

${error.message}

Error message

${error.message}

What it means

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.

Solutions

  1. Read the returned error.message and server logs - it names the settings-layer failure.
  2. Restart the server so boot migrations/validation re-run.
  3. If a bad settings row is implicated, clear the community hub keys in system_settings and re-save them from the UI.
Defensive patterns

Strategy: try-catch

Try / catch

try { const { connectionKey } = await getHubSettings(); }
catch (e) {
  if (e.status === 500) throw new Error('Hub settings unreadable - DB layer failure, check server logs');
  if (e.status === 401 || e.status === 403) throw new Error('Admin session required');
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: Instances upgraded with interrupted migrations; direct DB edits; volume permission changes.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18). Data as JSON: /api/errors/45e8818e7241f1b4. Report an issue: GitHub.

Appendix: source

Thrown at server/endpoints/communityHub.js:28

const { Telemetry } = require("../models/telemetry");
const {
  flexUserRoleValid,
  ROLES,
} = require("../utils/middleware/multiUserProtected");

function communityHubEndpoints(app) {
  if (!app) return;

  app.get(
    "/community-hub/settings",
    [validatedRequest, flexUserRoleValid([ROLES.admin])],
    async (_, response) => {
      try {
        const { connectionKey } = await SystemSettings.hubSettings();
        response.status(200).json({ success: true, connectionKey });
      } catch (error) {
        console.error(error);
        response.status(500).json({ success: false, error: error.message });
      }
    }
  );

  app.post(
    "/community-hub/settings",
    [validatedRequest, flexUserRoleValid([ROLES.admin])],
    async (request, response) => {
      try {
        const data = reqBody(request);
        const result = await SystemSettings.updateSettings(data);
        if (result.error) throw new Error(result.error);
        response.status(200).json({ success: true, error: null });
      } catch (error) {
        console.error(error);
        response.status(500).json({ success: false, error: error.message });
      }
    }

View on GitHub (pinned to 3aec848f28)