RocketChat/Rocket.Chat · error · Error
error-invalid-param
error-invalid-param
Error message
error-invalid-param
What it means
Thrown by GET email-inbox/:_id when the '_id' URL parameter is empty/falsy. It is thrown as a plain Error (not Meteor.Error), so the string 'error-invalid-param' is both the code and the message — there is no human-readable detail. The route already requires the manage-email-inbox permission, so reaching this throw means auth passed but the path segment was blank.
Source
Thrown at apps/meteor/server/api/v1/email-inbox.ts:146
properties: {
success: { type: 'boolean', enum: [true] },
},
required: ['success'],
},
],
},
{ type: 'null' },
],
}),
401: validateUnauthorizedErrorResponse,
403: validateForbiddenErrorResponse,
404: validateNotFoundErrorResponse,
},
},
async function action() {
const { _id } = this.urlParams;
if (!_id) {
throw new Error('error-invalid-param');
}
const emailInbox = await EmailInbox.findOneById(_id);
if (!emailInbox) {
return API.v1.notFound();
}
return API.v1.success(emailInbox);
},
);
API.v1.delete(
'email-inbox/:_id',
{
authRequired: true,
permissionsRequired: ['manage-email-inbox'],
response: {
200: ajv.compile<{ _id: string }>({View on GitHub (pinned to f9d3ec372b)
Solutions
- Provide a non-empty _id in the path: GET /api/v1/email-inbox/<id>.
- Validate the id is a non-empty string before constructing the URL.
Example fix
// before
fetch(`/api/v1/email-inbox/${maybeId}`) // maybeId may be undefined
// after
if (!maybeId) throw new Error('inbox id required');
fetch(`/api/v1/email-inbox/${encodeURIComponent(maybeId)}`) Defensive patterns
Strategy: validation
Validate before calling
if (!_id || typeof _id !== 'string') throw new Error('email-inbox id required');
const url = `/api/v1/email-inbox/${encodeURIComponent(_id)}`; Type guard
function isInboxId(s): s is string { return typeof s === 'string' && s.length > 0; } Try / catch
try { await getEmailInbox(_id); }
catch (e) {
if (e?.message === 'error-invalid-param') { /* fix caller to pass an id */) }
else throw e;
} Prevention
- Always URL-encode and require a non-empty id segment.
- Treat an empty id as a programmer error, not a runtime retry.
When it happens
Trigger: Calling 'email-inbox/' with an empty id segment; client routing bug strips the id; trailing slash producing an empty match.
Common situations: Client builds the URL from an undefined variable; copy-paste of the route without substituting the id; framework that drops empty path params.
Related errors
- The "${name}" parameter must be a valid date.
- error-duplicate-role-names-not-allowed
- error-room-not-found
- The required "mid" body param is missing.
- error-roomId-param-invalid
AI-assisted analysis of RocketChat/Rocket.Chat@f9d3ec372b (2026-08-12).
Data as JSON: /api/errors/1c470736364f1bea.
Report an issue: GitHub.