Mintplex-Labs/anything-llm · warning

Internal Server Error

Error message

Internal Server Error

What it means

HTTP 500 from the catch-all of POST /ext/:repo_platform/branches (fetch branch list for a git repo provider). The route calls new CollectorApi().forwardExtensionRequest(...). Critically, forwardExtensionRequest catches its own fetch errors and returns {success:false,reason} — it never rejects — and there is no Telemetry call on this route. So a collector/document-processor outage surfaces as a 200 with a failure body, NOT a 500. This catch therefore fires only on truly unexpected errors: a synchronous throw from the CollectorApi constructor (CommunicationKey init) or a JSON serialization fault.

Source

Thrown at server/endpoints/extensions/index.js:34

    "/ext/:repo_platform/branches",
    [
      validatedRequest,
      flexUserRoleValid([ROLES.admin, ROLES.manager]),
      isSupportedRepoProvider,
    ],
    async (request, response) => {
      try {
        const { repo_platform } = request.params;
        const responseFromProcessor =
          await new CollectorApi().forwardExtensionRequest({
            endpoint: `/ext/${repo_platform}-repo/branches`,
            method: "POST",
            body: request.body,
          });
        response.status(200).json(responseFromProcessor);
      } catch (e) {
        console.error(e);
        response.sendStatus(500).end();
      }
    }
  );

  app.post(
    "/ext/:repo_platform/repo",
    [
      validatedRequest,
      flexUserRoleValid([ROLES.admin, ROLES.manager]),
      isSupportedRepoProvider,
    ],
    async (request, response) => {
      try {
        const { repo_platform } = request.params;
        const responseFromProcessor =
          await new CollectorApi().forwardExtensionRequest({
            endpoint: `/ext/${repo_platform}-repo`,
            method: "POST",

View on GitHub (pinned to 526360e320)

Solutions

  1. Distinguish: if the HTTP response is 200 with {success:false,reason:...}, the collector is unreachable/misconfigured — start/fix the collector service and check COLLECTOR_PORT. If the response is a true 500, inspect the server log for the constructor/EncryptionManager stack trace.
  2. Ensure the communication key material is present and valid (regenerate if corrupted, then restart both server and collector so they share the key).
  3. Confirm repo_platform is a supported provider (the isSupportedRepoProvider middleware already filters this).
  4. Verify the collector service is running and reachable at the configured host/port.
Defensive patterns

Strategy: fallback

Validate before calling

// Health-check the collector before issuing extension calls.
async function collectorAlive(baseUrl, token) {
  // There is no direct collector health route; use a lightweight extension probe and inspect the body.
  return true; // placeholder — real check is the response shape below
}

Try / catch

// Distinguish a true 500 (key/construction fault) from 200 success:false (collector issue).
const res = await fetch(`${baseUrl}/ext/${repo_platform}/branches`, {
  method: "POST",
  headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json" },
  body: JSON.stringify(payload)
});
if (res.status === 500) {
  // CommunicationKey/EncryptionManager fault — check server logs, regenerate key.
  throw new Error(`extension infra failure (500) — inspect server logs`);
}
const body = await res.json();
if (body?.success === false) {
  // Collector unreachable/misconfigured — NOT a 500. Surface body.reason to the user.
  return { ok: false, reason: body.reason };
}
return { ok: true, data: body };

Prevention

When it happens

Trigger: The CommunicationKey (shared secret with the collector) failing to initialize (missing/corrupt key material), or new EncryptionManager() throwing during request construction. A collector that is simply unreachable does NOT trigger this 500 — it returns 200 with success:false.

Common situations: Corrupt or missing COLLECTOR_API_KEY / communication key after a botched upgrade or restore; ENV misconfiguration that breaks key loading on boot; a code change to EncryptionManager that throws on instantiation.

Understand the failure class

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13). Data as JSON: /api/errors/60ae2ca9552d01f6. Report an issue: GitHub.