RocketChat/Rocket.Chat · error · Error
Invalid username
Error message
Invalid username
What it means
Error "Invalid username" thrown in RocketChat/Rocket.Chat.
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.
Example fix
Validate the username parameter: if (!username || typeof username !== 'string') { throw new Error('Invalid username'); } When it happens
Trigger: Thrown at apps/meteor/app/apps/server/bridges/messages.ts:110 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/80dbc630943c2ee9.
Report an issue: GitHub.
Appendix: source
Thrown at apps/meteor/app/apps/server/bridges/messages.ts:110
// #TODO: #AppsEngineTypes - Remove explicit types and typecasts once the apps-engine definition/implementation mismatch is fixed.
const msg: IMessage | undefined = await this.orch.getConverters()?.get('messages').convertAppMessage(message);
const convertedMessage = msg as IMessage;
const users = (await Subscriptions.findByRoomIdWhenUserIdExists(room.id, { projection: { 'u._id': 1 } }).toArray()).map((s) => s.u._id);
await Users.findByIds(users, { projection: { _id: 1 } }).forEach(
({ _id }: { _id: string }) =>
void api.broadcast('notify.ephemeralMessage', _id, room.id, {
...convertedMessage,
}),
);
}
protected async typing({ scope, id, username, isTyping }: ITypingDescriptor): Promise<void> {
switch (scope) {
case 'room':
if (!username) {
throw new Error('Invalid username');
}
notifications.notifyRoom(id, 'user-activity', username, isTyping ? ['user-typing'] : []);
return;
default:
throw new Error('Unrecognized typing scope provided');
}
}
private isValidReaction(reaction: Reaction): boolean {
return reaction.startsWith(':') && reaction.endsWith(':');
}
protected async addReaction(messageId: string, userId: string, reaction: Reaction): Promise<void> {
if (!this.isValidReaction(reaction)) {
throw new Error('Invalid reaction');
}
View on GitHub (pinned to b2c16d5842)