RocketChat/Rocket.Chat · error · Meteor.Error
error-invalid-user
error-invalid-user
Error message
Invalid user
What it means
The Meteor method wrapper for updateIncomingIntegration throws error-invalid-user when this.userId is unset, i.e. the DDP call arrived over a connection with no authenticated user. The error's details object carries the stale method name 'updateOutgoingIntegration' — a copy-paste artifact that can mislead log greps, so match on the error code, not the method detail.
Source
Thrown at apps/meteor/server/meteor-methods/integrations/incoming/updateIncomingIntegration.ts:204
_updatedAt: new Date(),
_updatedBy: await Users.findOne({ _id: userId }, { projection: { username: 1 } }),
},
},
{ returnDocument: 'after' },
);
if (updatedIntegration) {
void notifyOnIntegrationChanged(updatedIntegration);
}
return updatedIntegration;
};
Meteor.methods<ServerMethods>({
async updateIncomingIntegration(integrationId, integration) {
methodDeprecationLogger.method('updateIncomingIntegration', '9.0.0', '/v1/integrations.update');
if (!this.userId) {
throw new Meteor.Error('error-invalid-user', 'Invalid user', {
method: 'updateOutgoingIntegration',
});
}
return updateIncomingIntegration(this.userId, integrationId, integration);
},
});
View on GitHub (pinned to b2c16d5842)
Solutions
- Log in first (Meteor.loginWithPassword / token login) and retry the method call
- For scripts, switch to POST /v1/integrations.update with X-Auth-Token and X-User-Id headers
- On the client, catch the error, redirect to login, and retry after re-authentication
Example fix
// before
Meteor.call('updateIncomingIntegration', id, payload, cb);
// after
if (!Meteor.userId()) {
// route to login and retry after authentication
throw new Meteor.Error('error-invalid-user', 'Login required');
}
await Meteor.callAsync('updateIncomingIntegration', id, payload); Defensive patterns
Strategy: validation
Validate before calling
if (!Meteor.userId()) {
// route to login instead of calling the method
} Try / catch
try {
await Meteor.callAsync('updateIncomingIntegration', id, payload);
} catch (err) {
if (err instanceof Meteor.Error && err.error === 'error-invalid-user') {
// session lost: prompt re-login, then retry once
return;
}
throw err;
} Prevention
- Call integration admin methods only from authenticated sessions
- Prefer REST /v1/integrations.update with token headers for scripts
- Do not match this error by its method detail — the string says updateOutgoingIntegration
When it happens
Trigger: Meteor.callAsync('updateIncomingIntegration', ...) from a logged-out client, or from a session whose login expired and resumed without a bound user.
Common situations: Automation scripts or bots calling DDP methods directly without a login flow; admin UI left open past session expiry; integration tests that forget to stub this.userId.
Understand the failure class
Background: error-invalid-user: "Invalid user" errors in Rocket.Chat — what they mean and how to fix them — this error's family across 2 libraries.
Related errors
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/e80b833382f7ef0b.
Report an issue: GitHub.