Mintplex-Labs/anything-llm · error

Internal Server Error

Error message

Internal Server Error

What it means

Bare 500 from the catch-all wrapping GET /v1/embeds. The handler runs a Prisma query that includes per-embed chat counts (embed._count.embed_chats) before mapping to the response shape, so any database-level failure — dropped connection, unreachable Postgres, schema drift after an upgrade — surfaces as this bare 500.

Solutions

  1. Read the server console — the Prisma error is printed by the catch
  2. Verify the database is up and credentials are valid
  3. Restart the server so startup migrations run (visible in container logs)
  4. Retry the listing once the database is healthy
Defensive patterns

Strategy: retry

Try / catch

async function listEmbedsWithRetry(api, tries = 3) {
  for (let i = 0; i < tries; i++) {
    try {
      return (await api.get('/v1/embeds')).data;
    } catch (e) {
      if (e.response?.status !== 500 || i === tries - 1) throw e;
      await new Promise(r => setTimeout(r, 1000 * 2 ** i));
    }
  }
}

Prevention

When it happens

Trigger: Database down or restarting when listing embeds; Prisma schema out of sync (upgrade without migrations) so embed_config/embed_chats relations are missing; connection pool exhaustion.

Common situations: Upgrading AnythingLLM without letting boot migrations run; rotated database credentials; sqlite file locked by a concurrent process.

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/417667850ad5a15d. Report an issue: GitHub.

Appendix: source

Thrown at server/endpoints/api/embed/index.js:74

    */
    try {
      const embeds = await EmbedConfig.whereWithWorkspace();
      const filteredEmbeds = embeds.map((embed) => ({
        id: embed.id,
        uuid: embed.uuid,
        enabled: embed.enabled,
        chat_mode: embed.chat_mode,
        createdAt: embed.createdAt,
        workspace: {
          id: embed.workspace.id,
          name: embed.workspace.name,
        },
        chat_count: embed._count.embed_chats,
      }));
      response.status(200).json({ embeds: filteredEmbeds });
    } catch (e) {
      console.error(e.message, e);
      response.sendStatus(500).end();
    }
  });

  app.get(
    "/v1/embed/:embedUuid/chats",
    [validApiKey],
    async (request, response) => {
      /*
      #swagger.tags = ['Embed']
      #swagger.description = 'Get all chats for a specific embed'
      #swagger.parameters['embedUuid'] = {
        in: 'path',
        description: 'UUID of the embed',
        required: true,
        type: 'string'
      }
      #swagger.responses[200] = {
        content: {

View on GitHub (pinned to 3aec848f28)