RocketChat/Rocket.Chat · error · Meteor.Error
error-invalid-user
error-invalid-user
Error message
Invalid user
What it means
The banner/dismiss Meteor method requires an authenticated user; Meteor.userId() returned null. The method is deprecated since 9.0.0 in favor of POST /v1/banners.dismiss, as logged by methodDeprecationLogger on every call.
Source
Thrown at apps/meteor/server/meteor-methods/platform/banner_dismiss.ts:20
import { Users } from '@rocket.chat/models';
import { Meteor } from 'meteor/meteor';
import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger';
import { notifyOnUserChange } from '../../lib/notifyListener';
declare module '@rocket.chat/ddp-client' {
// eslint-disable-next-line @typescript-eslint/naming-convention
interface ServerMethods {
'banner/dismiss'({ id }: { id: string }): void;
}
}
Meteor.methods<ServerMethods>({
async 'banner/dismiss'({ id }) {
methodDeprecationLogger.method('banner/dismiss', '9.0.0', '/v1/banners.dismiss');
const userId = Meteor.userId();
if (!userId) {
throw new Meteor.Error('error-invalid-user', 'Invalid user', { method: 'banner/dismiss' });
}
await Users.setBannerReadById(userId, id);
void notifyOnUserChange({
id: userId,
clientAction: 'updated',
diff: {
[`banners.${id}.read`]: true,
},
});
},
});
View on GitHub (pinned to b2c16d5842)
Solutions
- Migrate to POST /api/v1/banners.dismiss with { bannerId } and auth headers (the DDP method will be removed)
- Ensure the user is logged in before calling (check Meteor.userId() client-side)
- On this error, re-authenticate once and retry, or fall back to the REST endpoint
Example fix
// before
Meteor.call('banner/dismiss', { id });
// after
await fetch('/api/v1/banners.dismiss', {
method: 'POST',
headers: { 'X-Auth-Token': token, 'X-User-Id': uid, 'Content-Type': 'application/json' },
body: JSON.stringify({ bannerId: id }),
}); Defensive patterns
Strategy: try-catch
Validate before calling
if (!Meteor.userId()) {
await ensureLogin();
}
// better: migrate off the deprecated method entirely Type guard
const isInvalidUserError = (e: unknown): e is Meteor.Error =>
typeof e === 'object' && e !== null && (e as { error?: string }).error === 'error-invalid-user'; Try / catch
try {
Meteor.call('banner/dismiss', { id });
} catch (e) {
if (isInvalidUserError(e)) {
await reauthenticate();
return dismissBannerViaRest(id); // POST /v1/banners.dismiss
}
throw e;
} Prevention
- Replace banner/dismiss with POST /v1/banners.dismiss before the 9.x removal
- Check Meteor.userId() before any authenticated method call
- Watch methodDeprecationLogger warnings during upgrade testing
When it happens
Trigger: Calling 'banner/dismiss' on an unauthenticated DDP connection or before the saved login resumes; stale clients on upgraded workspaces still calling the deprecated method.
Common situations: Upgrade to Rocket.Chat 9.x where the method is deprecated; custom clients dismissing banners during startup races; scripts calling the method without a session.
Related errors
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/6c694788465e2e3a.
Report an issue: GitHub.