RocketChat/Rocket.Chat · error · Meteor.Error
error-creating-custom-user-status
error-creating-custom-user-status
Error message
Error creating custom user status
What it means
Thrown by POST custom-user-status.create after insertOrUpdateUserStatus ran but CustomUserStatus.findOneByName(name) returns null. The body was already AJV-validated, so this is a consistency failure: the insert did not yield a findable record. Likely a race, a masked write error, or a name lookup mismatch (case/whitespace).
Source
Thrown at apps/meteor/server/api/v1/custom-user-status.ts:171
body: isCustomUserStatusCreateProps,
response: {
200: customUserStatusCreateResponseSchema,
400: validateBadRequestErrorResponse,
401: validateUnauthorizedErrorResponse,
403: validateForbiddenErrorResponse,
},
},
async function action() {
const userStatusData = {
name: this.bodyParams.name,
statusType: this.bodyParams.statusType || '',
};
await insertOrUpdateUserStatus(this.userId, userStatusData);
const customUserStatus = await CustomUserStatus.findOneByName(userStatusData.name);
if (!customUserStatus) {
throw new Meteor.Error('error-creating-custom-user-status', 'Error creating custom user status');
}
return API.v1.success({
customUserStatus,
});
},
);
const isCustomUserStatusDeleteProps = ajv.compile<{ customUserStatusId: string }>({
type: 'object',
properties: {
customUserStatusId: { type: 'string', minLength: 1 },
},
required: ['customUserStatusId'],
additionalProperties: false,
});
const customUserStatusDeleteResponseSchema = ajv.compile<void>({View on GitHub (pinned to f9d3ec372b)
Solutions
- Retry the create request once.
- Inspect server logs for errors emitted by insertOrUpdateUserStatus.
- Check whether a status with the same name (any case) already exists and pick a unique name.
- If persistent, treat as a server fault (500) and escalate to an admin.
Defensive patterns
Strategy: retry
Validate before calling
// pre-check that no status with the same name (case-insensitive) exists
const existing = await CustomUserStatus.findOneByName(name.trim());
if (existing) { /* pick another name */ } Try / catch
try { await createCustomUserStatus({ name, statusType }); }
catch (e) {
if (isApiError(e, 'error-creating-custom-user-status')) { /* retry once, then surface server error */) }
else throw e;
} Prevention
- Treat this code as a server-side consistency fault, not an input error.
- Check server logs for insertOrUpdateUserStatus failures.
- Avoid concurrent creates of the same name.
When it happens
Trigger: Another process deletes the status between insert and findOneByName; insertOrUpdateUserStatus silently swallowed a DB error; the stored name differs from the queried name due to trimming/case collation.
Common situations: Concurrent admin operations; DB connectivity blip during insert; duplicate name with different casing already present.
Related errors
- error-updating-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/5b8139c117ba1d50.
Report an issue: GitHub.