{"record":{"id":"3910419a8fb08c42","repo":"Mintplex-Labs/anything-llm","slug":"response-sendstatus-401-end","errorCode":null,"errorMessage":"response.sendStatus(401).end();","messagePattern":"response\\.sendStatus\\(401\\)\\.end\\(\\);","errorType":"http","errorClass":null,"httpStatus":401,"severity":"error","filePath":"server/endpoints/api/admin/index.js","lineNumber":130,"sourceCode":"              },\n              error: null,\n            }\n          }\n        }\n      }\n    }\n    #swagger.responses[403] = {\n      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 newUserParams = reqBody(request);\n      const { user: newUser, error } = await User.create(newUserParams);\n      response.status(newUser ? 200 : 400).json({ user: newUser, error });\n    } catch (e) {\n      console.error(e);\n      response.sendStatus(500).end();\n    }\n  });\n\n  app.post(\"/v1/admin/users/:id\", [validApiKey], async (request, response) => {\n    /*\n    #swagger.tags = ['Admin']\n    #swagger.parameters['id'] = {\n      in: 'path',\n      description: 'id of the user in the database.',","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/endpoints/api/admin/index.js#L112-L148","documentation":"This \"message\" marks the multi-user-mode guard on the create-user admin route: when multiUserMode(response) is false the handler responds with a bare 401 and stops; body of the record is that no error payload is returned.","triggerScenarios":"Admin endpoint rejected an unauthenticated request. Triggered when authentication fails for the admin route, resulting in a bare 401 (api/admin/index.js:130).","commonSituations":"See trigger scenarios.","solutions":["Enable Multi-User mode in security settings — this admin endpoint requires it.","Provide a valid API key with the request."],"exampleFix":null,"handlingStrategy":"validation","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-14T05:17:10.506Z"}