{"record":{"id":"417667850ad5a15d","repo":"Mintplex-Labs/anything-llm","slug":"internal-server-error-417667","errorCode":null,"errorMessage":"Internal Server Error","messagePattern":"Internal Server Error","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"server/endpoints/api/embed/index.js","lineNumber":74,"sourceCode":"    */\n    try {\n      const embeds = await EmbedConfig.whereWithWorkspace();\n      const filteredEmbeds = embeds.map((embed) => ({\n        id: embed.id,\n        uuid: embed.uuid,\n        enabled: embed.enabled,\n        chat_mode: embed.chat_mode,\n        createdAt: embed.createdAt,\n        workspace: {\n          id: embed.workspace.id,\n          name: embed.workspace.name,\n        },\n        chat_count: embed._count.embed_chats,\n      }));\n      response.status(200).json({ embeds: filteredEmbeds });\n    } catch (e) {\n      console.error(e.message, e);\n      response.sendStatus(500).end();\n    }\n  });\n\n  app.get(\n    \"/v1/embed/:embedUuid/chats\",\n    [validApiKey],\n    async (request, response) => {\n      /*\n      #swagger.tags = ['Embed']\n      #swagger.description = 'Get all chats for a specific embed'\n      #swagger.parameters['embedUuid'] = {\n        in: 'path',\n        description: 'UUID of the embed',\n        required: true,\n        type: 'string'\n      }\n      #swagger.responses[200] = {\n        content: {","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/endpoints/api/embed/index.js#L56-L92","documentation":"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.","triggerScenarios":"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.","commonSituations":"Upgrading AnythingLLM without letting boot migrations run; rotated database credentials; sqlite file locked by a concurrent process.","solutions":["Read the server console — the Prisma error is printed by the catch","Verify the database is up and credentials are valid","Restart the server so startup migrations run (visible in container logs)","Retry the listing once the database is healthy"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"async function listEmbedsWithRetry(api, tries = 3) {\n  for (let i = 0; i < tries; i++) {\n    try {\n      return (await api.get('/v1/embeds')).data;\n    } catch (e) {\n      if (e.response?.status !== 500 || i === tries - 1) throw e;\n      await new Promise(r => setTimeout(r, 1000 * 2 ** i));\n    }\n  }\n}","preventionTips":["Retry with backoff — most of these 500s are transient DB blips","Let server startup migrations complete before calling embed endpoints","Monitor database connectivity; a 500 here is almost always logged as a Prisma error server-side"],"tags":["embed","prisma","database","http-500"],"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"}