RocketChat/Rocket.Chat · error
User not provided
Error message
User not provided
What it means
The users bridge update refuses to proceed when the user argument is falsy. The call requires the existing user object (at minimum its id); passing undefined/null — often from an optional lookup that returned nothing — trips this guard before any field is written.
Solutions
- Fetch the user first (by id via the user reader) and abort when not found.
- Guard at the call site: if (!user) return; before updating.
- Ensure the user exists (bot/app creation) before attempting updates.
Example fix
// before
await updateUser(maybeUser, fields, appId); // maybeUser may be undefined
// after
if (!user) {
throw new Error('Cannot update a user that does not exist');
}
await updateUser(user, fields, appId); Defensive patterns
Strategy: validation
Validate before calling
if (!user || !user.id) {
// nothing to update
return;
} Type guard
const isExistingUser = (u: IUser | null | undefined): u is IUser & { id: string } =>
Boolean(u && u.id); Prevention
- Fetch-then-guard: never forward optional lookup results into update.
- Create the (bot) user before updating it.
- Log which user failed when guarding at the boundary.
When it happens
Trigger: App calls user update with a variable produced by a lookup that returned undefined (user gone, wrong id); destructuring a missing parameter; updating a user before it was created.
Common situations: Optional-chained lookups not guarded; app updating its bot user before the framework created it; races with uninstall removing the user mid-flow.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Invalid user id
- A new user type has been added that the Apps don't know…
- Creating normal users is currently not supported
- error-cannot-delete-app-user
- roomId was not provided.
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/c19afbe7dea57b9f.
Report an issue: GitHub.
Appendix: 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 b2c16d5842)