RocketChat/Rocket.Chat · error · Meteor.Error
error-invalid-user
error-invalid-user
Error message
Invalid user
What it means
getLatestImportOperations lists past imports; it first requires a logged-in user and throws error-invalid-user when `Meteor.userId()` is null. Without an authenticated session the operation history is never disclosed.
Source
Thrown at apps/meteor/server/meteor-methods/import/getLatestImportOperations.ts:34
);
return data.toArray();
};
declare module '@rocket.chat/ddp-client' {
// eslint-disable-next-line @typescript-eslint/naming-convention
interface ServerMethods {
getLatestImportOperations(): IImport[];
}
}
Meteor.methods<ServerMethods>({
async getLatestImportOperations() {
methodDeprecationLogger.method('getLatestImportOperations', '9.0.0', '/v1/getLatestImportOperations');
const userId = Meteor.userId();
if (!userId) {
throw new Meteor.Error('error-invalid-user', 'Invalid user', 'getLatestImportOperations');
}
if (!(await hasPermissionAsync(userId, 'view-import-operations'))) {
throw new Meteor.Error('not_authorized', 'User not authorized', 'getLatestImportOperations');
}
return executeGetLatestImportOperations();
},
});
View on GitHub (pinned to b2c16d5842)
Solutions
- Log in and verify `Meteor.userId()` before calling
- Re-authenticate and retry once when this error appears
- Use GET/POST /v1/getLatestImportOperations with auth headers for programmatic access
Example fix
// before
Meteor.call('getLatestImportOperations', cb); // error-invalid-user
// after
if (!Meteor.userId()) await relogin();
Meteor.call('getLatestImportOperations', cb); Defensive patterns
Strategy: validation
Validate before calling
if (!Meteor.userId()) { await relogin(); }
Meteor.call('getLatestImportOperations', cb); Try / catch
Meteor.call('getLatestImportOperations', (err, ops) => {
if (err && (err as Meteor.Error).error === 'error-invalid-user') {
// re-authenticate, then retry once
}
}); Prevention
- Authenticate dashboards before loading import history
- Handle token expiry uniformly for all admin-area calls
- Use REST /v1/getLatestImportOperations for scripts
When it happens
Trigger: Calling `Meteor.call('getLatestImportOperations')` from an anonymous DDP connection, an expired session, or server code without a user bound to the invocation.
Common situations: Admin dashboards loaded after session timeout; scripts querying import history without login; preflight checks run before authentication completes.
Related errors
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/21fb032b9987c0ed.
Report an issue: GitHub.