{"record":{"id":"80dbc630943c2ee9","repo":"RocketChat/Rocket.Chat","slug":"invalid-username","errorCode":null,"errorMessage":"Invalid username","messagePattern":"Invalid username","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/app/apps/server/bridges/messages.ts","lineNumber":110,"sourceCode":"\t\t// #TODO: #AppsEngineTypes - Remove explicit types and typecasts once the apps-engine definition/implementation mismatch is fixed.\n\t\tconst msg: IMessage | undefined = await this.orch.getConverters()?.get('messages').convertAppMessage(message);\n\t\tconst convertedMessage = msg as IMessage;\n\n\t\tconst users = (await Subscriptions.findByRoomIdWhenUserIdExists(room.id, { projection: { 'u._id': 1 } }).toArray()).map((s) => s.u._id);\n\n\t\tawait Users.findByIds(users, { projection: { _id: 1 } }).forEach(\n\t\t\t({ _id }: { _id: string }) =>\n\t\t\t\tvoid api.broadcast('notify.ephemeralMessage', _id, room.id, {\n\t\t\t\t\t...convertedMessage,\n\t\t\t\t}),\n\t\t);\n\t}\n\n\tprotected async typing({ scope, id, username, isTyping }: ITypingDescriptor): Promise<void> {\n\t\tswitch (scope) {\n\t\t\tcase 'room':\n\t\t\t\tif (!username) {\n\t\t\t\t\tthrow new Error('Invalid username');\n\t\t\t\t}\n\n\t\t\t\tnotifications.notifyRoom(id, 'user-activity', username, isTyping ? ['user-typing'] : []);\n\t\t\t\treturn;\n\t\t\tdefault:\n\t\t\t\tthrow new Error('Unrecognized typing scope provided');\n\t\t}\n\t}\n\n\tprivate isValidReaction(reaction: Reaction): boolean {\n\t\treturn reaction.startsWith(':') && reaction.endsWith(':');\n\t}\n\n\tprotected async addReaction(messageId: string, userId: string, reaction: Reaction): Promise<void> {\n\t\tif (!this.isValidReaction(reaction)) {\n\t\t\tthrow new Error('Invalid reaction');\n\t\t}\n","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/app/apps/server/bridges/messages.ts#L92-L128","documentation":"Error \"Invalid username\" thrown in RocketChat/Rocket.Chat.","triggerScenarios":"Thrown at apps/meteor/app/apps/server/bridges/messages.ts:110 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a non-empty username in the typing descriptor when using the 'room' typing scope.","Ensure the app passes the typing user's username along with the room id."],"exampleFix":"Validate the username parameter: if (!username || typeof username !== 'string') { throw new Error('Invalid username'); }","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}