Mintplex-Labs/anything-llm · error

Internal Server Error

Error message

Internal Server Error

What it means

The catch-all 500 for POST /workspace/:slug/thread/new. The handler calls WorkspaceThread.new, Telemetry.sendTelemetry, and EventLogs.logEvent; any unhandled exception in these (most commonly a database insert failure in WorkspaceThread.new) returns 500.

Source

Thrown at server/endpoints/workspaceThreads.js:60

            Embedder: process.env.EMBEDDING_ENGINE || "inherit",
            VectorDbSelection: process.env.VECTOR_DB || "lancedb",
            TTSSelection: process.env.TTS_PROVIDER || "native",
            LLMModel: getModelTag(),
          },
          user?.id
        );

        await EventLogs.logEvent(
          "workspace_thread_created",
          {
            workspaceName: workspace?.name || "Unknown Workspace",
          },
          user?.id
        );
        response.status(200).json({ thread, message });
      } catch (e) {
        console.error(e.message, e);
        response.sendStatus(500).end();
      }
    }
  );

  app.get(
    "/workspace/:slug/threads",
    [validatedRequest, flexUserRoleValid([ROLES.all]), validWorkspaceSlug],
    async (request, response) => {
      try {
        const user = await userFromSession(request, response);
        const workspace = response.locals.workspace;
        const threads = await WorkspaceThread.where({
          workspace_id: workspace.id,
          user_id: user?.id || null,
        });

        const defaultThreadChatCount = await WorkspaceChats.count({
          workspaceId: workspace.id,

View on GitHub (pinned to 526360e320)

Solutions

  1. Inspect server logs for the exception message printed by console.error(e.message, e).
  2. Verify the workspace_threads table exists and matches the current ORM schema.
  3. Confirm database connectivity and available storage.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  const res = await api.post(`/workspace/${slug}/thread/new`);
} catch (e) {
  if (e.response?.status === 500) {
    // thread creation failed — check DB health, retry once
  } else { throw e; }
}

Prevention

When it happens

Trigger: Database write error during thread insertion; schema drift (workspace_threads table missing or mismatched); a concurrent migration locks the table; disk full preventing the DB write.

Common situations: DB locked during a migration; storage full; ORM schema out of sync with the database after an incomplete upgrade.

Understand the failure class

Related errors


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