{"record":{"id":"7c0ef3742b8285c3","repo":"Mintplex-Labs/anything-llm","slug":"invalid-user-id","errorCode":null,"errorMessage":"Invalid user ID","messagePattern":"Invalid user ID","errorType":"http","errorClass":null,"httpStatus":400,"severity":"error","filePath":"server/endpoints/system.js","lineNumber":1258,"sourceCode":"        response.setHeader(\"Content-Type\", contentType);\n        response.status(200).send(data);\n      } catch (e) {\n        console.error(e);\n        response.sendStatus(500).end();\n      }\n    }\n  );\n\n  // Used for when a user in multi-user updates their own profile\n  // from the UI.\n  app.post(\"/system/user\", [validatedRequest], async (request, response) => {\n    try {\n      const sessionUser = await userFromSession(request, response);\n      const { username, password, bio } = reqBody(request);\n      const id = Number(sessionUser.id);\n\n      if (!id) {\n        response.status(400).json({ success: false, error: \"Invalid user ID\" });\n        return;\n      }\n\n      const updates = {};\n      // If the username is being changed, validate it.\n      // Otherwise, do not attempt to validate it to allow existing users to keep their username if not changing it.\n      if (username !== sessionUser.username)\n        updates.username = User.validations.username(String(username));\n      if (password) updates.password = String(password);\n      if (bio) updates.bio = String(bio);\n\n      if (Object.keys(updates).length === 0) {\n        response\n          .status(400)\n          .json({ success: false, error: \"No updates provided\" });\n        return;\n      }\n","sourceCodeStart":1240,"sourceCodeEnd":1276,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/20f6d3546c1938bfea1ad304f58a592dddcc5948/server/endpoints/system.js#L1240-L1276","documentation":"Validation in POST /system/user (self-profile update): the authenticated session user's id cannot be coerced to a valid number, so the request cannot identify whose profile to update. Responds 400 with success:false before applying any changes.","triggerScenarios":"Thrown at server/endpoints/system.js:1244 when the library encounters an invalid state.","commonSituations":"A user management call referenced an invalid or nonexistent user ID.","solutions":["Provide a valid numeric user ID.","Verify the user exists before updating."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"20f6d3546c1938bfea1ad304f58a592dddcc5948","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}