Mintplex-Labs/anything-llm · critical

Internal Server Error

Error message

Internal Server Error

What it means

HTTP 500 from GET /onboarding. This is a public endpoint (no auth middleware) that calls SystemSettings.isOnboardingComplete(). The catch logs e.message and sends 500 with .end(). The throw comes from the SystemSettings model — typically a DB query against the system_settings table. Because this endpoint is hit during initial app load (before login), a 500 here can block the onboarding flow entirely, leaving the user unable to proceed.

Source

Thrown at server/endpoints/system.js:102

  app.get("/migrate", async (_, response) => {
    response.sendStatus(200);
  });

  app.get("/env-dump", async (_, response) => {
    if (process.env.NODE_ENV !== "production")
      return response.sendStatus(200).end();
    dumpENV();
    response.sendStatus(200).end();
  });

  app.get("/onboarding", async (_, response) => {
    try {
      const results = await SystemSettings.isOnboardingComplete();
      response.status(200).json({ onboardingComplete: results });
    } catch (e) {
      console.error(e.message, e);
      response.sendStatus(500).end();
    }
  });

  app.post("/onboarding", [validatedRequest], async (_, response) => {
    try {
      await SystemSettings.markOnboardingComplete();
      response.sendStatus(200).end();
    } catch (e) {
      console.error(e.message, e);
      response.sendStatus(500).end();
    }
  });

  app.get("/setup-complete", async (_, response) => {
    try {
      const results = await SystemSettings.currentSettings();
      response.status(200).json({ results });
    } catch (e) {

View on GitHub (pinned to 526360e320)

Solutions

  1. Check the server log for the exact Prisma error.
  2. Run the database migration (npx prisma migrate deploy or the project's setup script).
  3. Verify the system_settings table exists and has the expected schema (label/value columns).
  4. If the table exists but is empty, the onboarding flag may need to be seeded — check the project's seed script.
Defensive patterns

Strategy: try-catch

Validate before calling

// This is a public GET with no body/params to validate.
// The only pre-check is DB health.
// Ensure migrations are run before the server starts accepting requests.
// In a startup script:
//   npx prisma migrate deploy && node server/index.js

Try / catch

// Degrade gracefully — onboarding status is not worth crashing the page.
try {
  const results = await SystemSettings.isOnboardingComplete();
  response.status(200).json({ onboardingComplete: results });
} catch (e) {
  console.error('GET /onboarding failed:', e.message, e);
  // Default to true so the user can proceed past onboarding
  response.status(200).json({ onboardingComplete: true });
}

Prevention

When it happens

Trigger: SystemSettings.isOnboardingComplete queries the system_settings table which doesn't exist (migration not run); the DB connection is not initialized; the Prisma client doesn't have the SystemSettings model; the system_settings table exists but the expected row/column for the onboarding flag is missing.

Common situations: Fresh install where the database was created but seed/migration scripts weren't run; Docker container started without the DB volume, resulting in an empty database; Prisma generate not run after cloning; the onboarding setting label was renamed in a version upgrade.

Understand the failure class

Related errors


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