{"record":{"id":"b4d32820a3c0fe9e","repo":"Mintplex-Labs/anything-llm","slug":"invalid-auth-for-user","errorCode":null,"errorMessage":"Invalid auth for user.","messagePattern":"Invalid auth for user\\.","errorType":"http","errorClass":null,"httpStatus":401,"severity":"error","filePath":"server/utils/middleware/validatedRequest.js","lineNumber":95,"sourceCode":"\n  if (!token) {\n    response.status(401).json({\n      error: \"No auth token found.\",\n    });\n    return;\n  }\n\n  const valid = decodeJWT(token);\n  if (!valid || !valid.id) {\n    response.status(401).json({\n      error: \"Invalid auth token.\",\n    });\n    return;\n  }\n\n  const user = await User.get({ id: valid.id });\n  if (!user) {\n    response.status(401).json({\n      error: \"Invalid auth for user.\",\n    });\n    return;\n  }\n\n  if (user.suspended) {\n    response.status(401).json({\n      error: \"User is suspended from system\",\n    });\n    return;\n  }\n\n  response.locals.user = user;\n  UserMetaCache.setFromRequest(request, user.id);\n  next();\n}\n\nmodule.exports = {","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/utils/middleware/validatedRequest.js#L77-L113","documentation":"Auth guard in validateMultiUserRequest: the JWT decoded successfully but User.get for its embedded user id returned null, meaning the token references a user that no longer exists, so authentication is refused with 401.","triggerScenarios":"Invalid auth for user. Triggered when user-scoped token validation fails in validatedRequest (validatedRequest.js:95).","commonSituations":"See trigger scenarios.","solutions":["The user encoded in the token no longer exists; log in again with a valid user account.","Verify the user was not deleted from the system."],"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"}