RocketChat/Rocket.Chat · error · Meteor.Error
error-updating-custom-user-status
error-updating-custom-user-status
Error message
Error updating custom user status
What it means
Thrown by POST custom-user-status.update after insertOrUpdateUserStatus completed but CustomUserStatus.findOneById(_id) returns null. The record disappeared between the update and the re-fetch. Note the earlier 'no custom user status found' case is returned as API.v1.failure, whereas this post-update miss throws — so the throw specifically signals a race or vanishing record mid-request.
Source
Thrown at apps/meteor/server/api/v1/custom-user-status.ts:269
const userStatusData = {
_id: this.bodyParams._id,
name: this.bodyParams.name,
statusType: this.bodyParams.statusType || '',
};
const customUserStatusToUpdate = await CustomUserStatus.findOneById(userStatusData._id);
// Ensure the message exists
if (!customUserStatusToUpdate) {
return API.v1.failure(`No custom user status found with the id of "${userStatusData._id}".`);
}
await insertOrUpdateUserStatus(this.userId, userStatusData);
const customUserStatus = await CustomUserStatus.findOneById(userStatusData._id);
if (!customUserStatus) {
throw new Meteor.Error('error-updating-custom-user-status', 'Error updating custom user status');
}
return API.v1.success({
customUserStatus,
});
},
);
export type CustomUserStatusEndpoints = ExtractRoutesFromAPI<typeof customUserStatusEndpoints>;
declare module '@rocket.chat/rest-typings' {
// eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-empty-interface
interface Endpoints extends CustomUserStatusEndpoints {}
}
View on GitHub (pinned to f9d3ec372b)
Solutions
- Retry the update after confirming the status still exists.
- Guard against concurrent deletes (lock the UI row while editing).
- Reload the status list to obtain a fresh _id before re-submitting.
Defensive patterns
Strategy: retry
Validate before calling
// confirm the row still exists right before updating
const current = await CustomUserStatus.findOneById(_id);
if (!current) { /* abort update */ } Try / catch
try { await updateCustomUserStatus({ _id, name, statusType }); }
catch (e) {
if (isApiError(e, 'error-updating-custom-user-status')) { /* reload list, retry once */) }
else throw e;
} Prevention
- Lock the UI row while editing to avoid concurrent deletes.
- Reload the status list after a failure to obtain a fresh _id.
- Distinguish the API.v1.failure 'no status found' path from this thrown path.
When it happens
Trigger: Another admin/process deletes the status between the update call and the re-read; _id invalidated mid-flight; insertOrUpdateUserStatus deleted-then-failed.
Common situations: Two admins editing/deleting the same status concurrently; stale _id held by the client.
Related errors
- error-creating-custom-user-status
- error-e2e-key-reset-in-progress
- error-not-allowed
- error-room-not-found
- Room with id ${transferData.room} not found
AI-assisted analysis of RocketChat/Rocket.Chat@f9d3ec372b (2026-08-12).
Data as JSON: /api/errors/809a47d039fffbc0.
Report an issue: GitHub.