{"record":{"id":"3dc153300de82ac2","repo":"Mintplex-Labs/anything-llm","slug":"internal-server-error-3dc153","errorCode":null,"errorMessage":"Internal Server Error","messagePattern":"Internal Server Error","errorType":"http","errorClass":null,"httpStatus":500,"severity":"critical","filePath":"server/endpoints/system.js","lineNumber":102,"sourceCode":"\n  app.get(\"/migrate\", async (_, response) => {\n    response.sendStatus(200);\n  });\n\n  app.get(\"/env-dump\", async (_, response) => {\n    if (process.env.NODE_ENV !== \"production\")\n      return response.sendStatus(200).end();\n    dumpENV();\n    response.sendStatus(200).end();\n  });\n\n  app.get(\"/onboarding\", async (_, response) => {\n    try {\n      const results = await SystemSettings.isOnboardingComplete();\n      response.status(200).json({ onboardingComplete: results });\n    } catch (e) {\n      console.error(e.message, e);\n      response.sendStatus(500).end();\n    }\n  });\n\n  app.post(\"/onboarding\", [validatedRequest], async (_, response) => {\n    try {\n      await SystemSettings.markOnboardingComplete();\n      response.sendStatus(200).end();\n    } catch (e) {\n      console.error(e.message, e);\n      response.sendStatus(500).end();\n    }\n  });\n\n  app.get(\"/setup-complete\", async (_, response) => {\n    try {\n      const results = await SystemSettings.currentSettings();\n      response.status(200).json({ results });\n    } catch (e) {","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/server/endpoints/system.js#L84-L120","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check the server log for the exact Prisma error.","Run the database migration (npx prisma migrate deploy or the project's setup script).","Verify the system_settings table exists and has the expected schema (label/value columns).","If the table exists but is empty, the onboarding flag may need to be seeded — check the project's seed script."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// This is a public GET with no body/params to validate.\n// The only pre-check is DB health.\n// Ensure migrations are run before the server starts accepting requests.\n// In a startup script:\n//   npx prisma migrate deploy && node server/index.js","typeGuard":null,"tryCatchPattern":"// Degrade gracefully — onboarding status is not worth crashing the page.\ntry {\n  const results = await SystemSettings.isOnboardingComplete();\n  response.status(200).json({ onboardingComplete: results });\n} catch (e) {\n  console.error('GET /onboarding failed:', e.message, e);\n  // Default to true so the user can proceed past onboarding\n  response.status(200).json({ onboardingComplete: true });\n}","preventionTips":["Run prisma migrate deploy before starting the Express server — add it to the startup script or Docker entrypoint.","Add a DB connectivity check at boot that fails fast with a clear message if the system_settings table is missing.","Consider degrading gracefully: return onboardingComplete: true on error so users aren't locked out.","Monitor this endpoint — it's public and boot-critical, so alerts on 5xx are important."],"tags":["express","prisma","public-endpoint","system-settings","onboarding","boot-blocking"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}