{"record":{"id":"c19afbe7dea57b9f","repo":"RocketChat/Rocket.Chat","slug":"user-not-provided","errorCode":null,"errorMessage":"User not provided","messagePattern":"User not provided","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/app/apps/server/bridges/users.ts","lineNumber":134,"sourceCode":"\t\t// It's actually not a problem if there is no App user to delete - just means we don't need to do anything more.\n\t\tif (!user) {\n\t\t\treturn true;\n\t\t}\n\n\t\ttry {\n\t\t\tawait deleteUser(user.id);\n\t\t} catch (err) {\n\t\t\tthrow new Error(`Errors occurred while deleting an app user: ${err}`);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tprotected async update(user: IUser & { id: string }, fields: Partial<IUser>, appId: string): Promise<boolean> {\n\t\tthis.orch.debugLog(`The App ${appId} is updating a user`);\n\n\t\tif (!user) {\n\t\t\tthrow new Error('User not provided');\n\t\t}\n\n\t\tconst { status, statusText, ...updateFields } = fields;\n\n\t\tif (status) {\n\t\t\tawait Presence.setStatus(user.id, status as UserStatus, statusText);\n\t\t} else if (typeof statusText === 'string') {\n\t\t\tawait setStatusText(\n\t\t\t\t{\n\t\t\t\t\t_id: user.id,\n\t\t\t\t\tusername: user.username,\n\t\t\t\t\tname: user.name,\n\t\t\t\t\tstatus: user.status as UserStatus,\n\t\t\t\t\troles: user.roles,\n\t\t\t\t\tstatusText: user.statusText,\n\t\t\t\t},\n\t\t\t\tstatusText,\n\t\t\t);","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/app/apps/server/bridges/users.ts#L116-L152","documentation":"Thrown by the users bridge update method when the user argument is falsy. The bridge dereferences user.id immediately after the guard, so a null/undefined user is rejected up front rather than producing a NullPointerException deeper in the call stack.","triggerScenarios":"App calls update with a null/undefined user object, typically because a preceding lookup returned nothing and was passed through unchecked.","commonSituations":"User lookup by id returned undefined (user deleted/not found) and the app forwarded the result to update; refactoring left a placeholder variable; event handler received an empty payload.","solutions":["Check that the user object is defined and has an id before calling update.","Resolve the user via convertById/getUserById and early-return on miss.","Add a runtime guard at the boundary of your handler."],"exampleFix":"// before\nawait users.update(found, fields);\n\n// after\nif (!found) {\n  return;\n}\nawait users.update(found, fields);","handlingStrategy":"validation","validationCode":"if (!user || !user.id) {\n  throw new Error('Cannot update: no user provided');\n}","typeGuard":"function isDefinedUser(u: unknown): u is IUser & { id: string } {\n  return !!u && typeof (u as any).id === 'string';\n}","tryCatchPattern":null,"preventionTips":["Resolve the user and early-return on miss before calling update.","Guard handler boundaries against empty payloads.","Never forward undefined from a lookup into a mutating call."],"tags":["apps-engine","users","validation","argument-error"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}