Mintplex-Labs/anything-llm · error
Internal Server Error
Error message
Internal Server Error
What it means
Generic catch-all in GET /model-routers. Calls ModelRouter.getAllWithCounts which has a comprehensive internal try-catch returning []. The 500 fires only from infrastructure-level failures that prevent the model's inner catch from executing, such as the Prisma client module not loading correctly.
Source
Thrown at server/endpoints/modelRouter.js:24
const {
flexUserRoleValid,
ROLES,
} = require("../utils/middleware/multiUserProtected");
const { validatedRequest } = require("../utils/middleware/validatedRequest");
function modelRouterEndpoints(app) {
if (!app) return;
app.get(
"/model-routers",
[validatedRequest, flexUserRoleValid([ROLES.admin])],
async (_request, response) => {
try {
const routers = await ModelRouter.getAllWithCounts();
response.status(200).json({ routers });
} catch (e) {
console.error(e);
response.sendStatus(500);
}
}
);
app.get(
"/model-routers/:id",
[validatedRequest, flexUserRoleValid([ROLES.admin])],
async (request, response) => {
try {
const { id } = request.params;
const router = await ModelRouter.getWithRulesAndCount({
id: Number(id),
});
if (!router) {
response
.status(404)
.json({ router: null, error: "Router not found." });
return;View on GitHub (pinned to 526360e320)
Solutions
- Run npx prisma generate and npx prisma migrate deploy.
- Verify database connectivity.
- Check server logs for the specific Prisma or module-loading error.
- Ensure the model_routers table exists in the database.
Defensive patterns
Strategy: try-catch
Prevention
- Run npx prisma generate as a postinstall or build step.
- Run npx prisma migrate deploy before starting the server.
- Add a database health check endpoint to detect connectivity issues early.
When it happens
Trigger: Calling GET /model-routers when the Prisma client was not generated or the database is completely unreachable at a level below the Prisma query layer.
Common situations: Missing npx prisma generate step after deployment, database server not started, or the model_routers table not existing due to a pending migration.
Understand the failure class
- HTTP status errors: handling 4xx and 5xx responses — how to handle 4xx and 5xx responses properly.
Related errors
- Internal Server Error
- Internal Server Error
- Internal Server Error
- Internal Server Error
- Internal Server Error
AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13).
Data as JSON: /api/errors/8bffe614fd0ef866.
Report an issue: GitHub.