{"record":{"id":"f57be453c3d85f1f","repo":"Mintplex-Labs/anything-llm","slug":"response-sendstatus-500-end","errorCode":null,"errorMessage":"response.sendStatus(500).end();","messagePattern":"response\\.sendStatus\\(500\\)\\.end\\(\\);","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"server/endpoints/api/admin/index.js","lineNumber":81,"sourceCode":"      schema: {\n        \"$ref\": \"#/definitions/InvalidAPIKey\"\n      }\n    }\n     #swagger.responses[401] = {\n      description: \"Instance is not in Multi-User mode. Method denied\",\n    }\n    */\n    try {\n      if (!multiUserMode(response)) {\n        response.sendStatus(401).end();\n        return;\n      }\n\n      const users = await User.where();\n      response.status(200).json({ users });\n    } catch (e) {\n      console.error(e);\n      response.sendStatus(500).end();\n    }\n  });\n\n  app.post(\"/v1/admin/users/new\", [validApiKey], async (request, response) => {\n    /*\n    #swagger.tags = ['Admin']\n    #swagger.description = 'Create a new user with username and password. Methods are disabled until multi user mode is enabled via the UI.'\n    #swagger.requestBody = {\n        description: 'Key pair object that will define the new user to add to the system.',\n        required: true,\n        content: {\n          \"application/json\": {\n            example: {\n              username: \"sample-sam\",\n              password: 'hunter2',\n              role: 'default | admin'\n            }\n          }","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/endpoints/api/admin/index.js#L63-L99","documentation":"Catch-all handler in the admin users-list endpoint: an exception was thrown while fetching users (or the multiUserMode check) and logged, and a bare 500 status is sent as the generic failure response.","triggerScenarios":"Admin endpoint hit an unexpected server error. Triggered when an unhandled exception occurs in the admin API handler, resulting in a bare 500 (api/admin/index.js:81).","commonSituations":"See trigger scenarios.","solutions":["Check the server console log for the exception printed just before this 500 response.","Verify the database is reachable and migrations have run.","Retry the request; if it persists, report the logged stack trace."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}