RocketChat/Rocket.Chat · error · MeteorError
invalid-event-name
invalid-event-name
Error message
invalid-event-name
What it means
Rocket.Chat's streamer (server-side event bus over DDP) validates every subscription in _publish: an empty event name throws Meteor.Error 'invalid-event-name' before any permission check. The event name is the sub-stream key (room id, user id, etc.) that scopes which events the client receives.
Source
Thrown at apps/meteor/server/modules/streamer/streamer.module.ts:183
options: boolean | { useCollection?: boolean; args?: any } = false,
): Promise<void> {
let useCollection;
let args = [];
if (typeof options === 'boolean') {
useCollection = options;
} else {
if (options.useCollection) {
useCollection = options.useCollection;
}
if (options.args) {
args = options.args;
}
}
if (eventName.length === 0) {
throw new MeteorError('invalid-event-name');
}
if ((await this.isReadAllowed(publication, eventName, args)) !== true) {
throw new MeteorError('not-allowed');
}
// after meteor 3.4.1 immediately after a disconnection session becomes null (which is not wrong)
// we were just not counting on this, session is _session so we actually should not use it
// now after any await, the session can potentially be null, so we need to check for that
if (!Streamer.isPublicationActive(publication)) {
// if the client is disconnected, we don't want to do anything, it will not have an disconnect event to undo anymore
throw new MeteorError('publication-client-disconnected');
}
const subscription = {
subscription: publication,
eventName,
};View on GitHub (pinned to b2c16d5842)
Solutions
- Make sure the event-name argument (room/user id) is defined before subscribing
- Gate the subscription on the value being non-empty (only render/subscribe once the id is loaded)
- Double-check the streamer subscribe signature — eventName comes first, options second
- Log the computed event name right before subscribing during development
Example fix
// before
Meteor.autorun(() => {
Meteor.subscribe('stream-notify-room', roomId.get(), false); // roomId may be '' initially
});
// after
Meteor.autorun(() => {
const rid = roomId.get();
if (rid) {
Meteor.subscribe('stream-notify-room', rid, false);
}
}); Defensive patterns
Strategy: validation
Validate before calling
const isValidEventName = (eventName: unknown): boolean =>
typeof eventName === 'string' && eventName.length > 0;
// before subscribing
if (!isValidEventName(rid)) throw new Error('event name (rid) not loaded yet'); Type guard
const isNonEmptyString = (v: unknown): v is string => typeof v === 'string' && v.length > 0;
Prevention
- Only subscribe once the room id / user id is actually loaded
- Check subscribe argument order after any refactor (eventName first, options second)
- Log the computed event name during development to catch empty values early
When it happens
Trigger: Meteor.subscribe('stream-notify-room'|'stream-notify-user'|'stream-ui'|..., eventName, ...) with eventName === '' — typically a rid/userId variable that is undefined, null, or not yet loaded at subscribe time.
Common situations: Subscribing reactively before the room id or user id resolves at startup; refactors that changed the subscribe argument order; template helpers returning undefined; null concatenated into the event name.
Related errors
- not-allowed
- [Message Delivery] High delay detected: ${receiveDelay}ms. P
- error-invalid-user
- error-invalid-user
- error-invalid-room
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/85570a23f781f334.
Report an issue: GitHub.