RocketChat/Rocket.Chat · error · Error
User not provided
Error message
User not provided
What it means
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.
Source
Thrown at apps/meteor/app/apps/server/bridges/users.ts:134
// It's actually not a problem if there is no App user to delete - just means we don't need to do anything more.
if (!user) {
return true;
}
try {
await deleteUser(user.id);
} catch (err) {
throw new Error(`Errors occurred while deleting an app user: ${err}`);
}
return true;
}
protected async update(user: IUser & { id: string }, fields: Partial<IUser>, appId: string): Promise<boolean> {
this.orch.debugLog(`The App ${appId} is updating a user`);
if (!user) {
throw new Error('User not provided');
}
const { status, statusText, ...updateFields } = fields;
if (status) {
await Presence.setStatus(user.id, status as UserStatus, statusText);
} else if (typeof statusText === 'string') {
await setStatusText(
{
_id: user.id,
username: user.username,
name: user.name,
status: user.status as UserStatus,
roles: user.roles,
statusText: user.statusText,
},
statusText,
);View on GitHub (pinned to f9d3ec372b)
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.
Example fix
// before
await users.update(found, fields);
// after
if (!found) {
return;
}
await users.update(found, fields); Defensive patterns
Strategy: validation
Validate before calling
if (!user || !user.id) {
throw new Error('Cannot update: no user provided');
} Type guard
function isDefinedUser(u: unknown): u is IUser & { id: string } {
return !!u && typeof (u as any).id === 'string';
} Prevention
- 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.
When it happens
Trigger: App calls update with a null/undefined user object, typically because a preceding lookup returned nothing and was passed through unchecked.
Common situations: 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.
Related errors
- Invalid user id
- roomId was not provided.
- Creating normal users is currently not supported
- Invalid Api parameter provided, it must be a valid IApi obje
- Invalid command parameter provided, must be a string.
AI-assisted analysis of RocketChat/Rocket.Chat@f9d3ec372b (2026-08-12).
Data as JSON: /api/errors/c19afbe7dea57b9f.
Report an issue: GitHub.