{"record":{"id":"85570a23f781f334","repo":"RocketChat/Rocket.Chat","slug":"invalid-event-name","errorCode":"invalid-event-name","errorMessage":"invalid-event-name","messagePattern":"invalid-event-name","errorType":"error_code","errorClass":"MeteorError","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/modules/streamer/streamer.module.ts","lineNumber":183,"sourceCode":"\t\toptions: boolean | { useCollection?: boolean; args?: any } = false,\n\t): Promise<void> {\n\t\tlet useCollection;\n\t\tlet args = [];\n\n\t\tif (typeof options === 'boolean') {\n\t\t\tuseCollection = options;\n\t\t} else {\n\t\t\tif (options.useCollection) {\n\t\t\t\tuseCollection = options.useCollection;\n\t\t\t}\n\n\t\t\tif (options.args) {\n\t\t\t\targs = options.args;\n\t\t\t}\n\t\t}\n\n\t\tif (eventName.length === 0) {\n\t\t\tthrow new MeteorError('invalid-event-name');\n\t\t}\n\n\t\tif ((await this.isReadAllowed(publication, eventName, args)) !== true) {\n\t\t\tthrow new MeteorError('not-allowed');\n\t\t}\n\n\t\t// after meteor 3.4.1 immediately after a disconnection session becomes null (which is not wrong)\n\t\t// we were just not counting on this, session is _session so we actually should not use it\n\t\t// now after any await, the session can potentially be null, so we need to check for that\n\t\tif (!Streamer.isPublicationActive(publication)) {\n\t\t\t// if the client is disconnected, we don't want to do anything, it will not have an disconnect event to undo anymore\n\t\t\tthrow new MeteorError('publication-client-disconnected');\n\t\t}\n\n\t\tconst subscription = {\n\t\t\tsubscription: publication,\n\t\t\teventName,\n\t\t};","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/modules/streamer/streamer.module.ts#L165-L201","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nMeteor.autorun(() => {\n  Meteor.subscribe('stream-notify-room', roomId.get(), false); // roomId may be '' initially\n});\n\n// after\nMeteor.autorun(() => {\n  const rid = roomId.get();\n  if (rid) {\n    Meteor.subscribe('stream-notify-room', rid, false);\n  }\n});","handlingStrategy":"validation","validationCode":"const isValidEventName = (eventName: unknown): boolean =>\n  typeof eventName === 'string' && eventName.length > 0;\n\n// before subscribing\nif (!isValidEventName(rid)) throw new Error('event name (rid) not loaded yet');","typeGuard":"const isNonEmptyString = (v: unknown): v is string =>\n  typeof v === 'string' && v.length > 0;","tryCatchPattern":null,"preventionTips":["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"],"tags":["ddp","meteor","streamer","realtime","subscriptions"],"backgroundTag":"invalid-event-name","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}