RocketChat/Rocket.Chat · error · Meteor.Error
error-invalid-params
error-invalid-params
Error message
error-invalid-params
What it means
GET /api/v1/livechat/contact requires at least one lookup criterion: email, phone, or a non-empty parsed custom object. When all are absent (or custom parses to {}), the endpoint throws Meteor.Error 'error-invalid-params'.
Solutions
- Always include at least one of ?email=..., ?phone=..., or a non-empty ?custom={"field":"value"}.
- Validate before the call: reject empty searches in the UI instead of hitting the API.
- If you need to browse contacts without a criterion, use an authenticated visitors listing/search endpoint instead of livechat/contact.
Example fix
// before
fetch('/api/v1/livechat/contact'); // no criterion -> error-invalid-params
// after
const qs = new URLSearchParams();
if (email) qs.set('email', email);
if (phone) qs.set('phone', phone);
if (Object.keys(custom).length) qs.set('custom', JSON.stringify(custom));
if (![...qs.keys()].length) throw new Error('Provide email, phone or custom');
fetch(`/api/v1/livechat/contact?${qs}`); Defensive patterns
Strategy: validation
Validate before calling
function hasContactCriterion(p: { email?: string; phone?: string; custom?: Record<string, string> }): boolean {
return Boolean(p.email || p.phone || (p.custom && Object.keys(p.custom).length > 0));
}
if (!hasContactCriterion(params)) throw new RangeError('livechat/contact needs email, phone or non-empty custom'); Prevention
- Disable the search action until the user entered at least one criterion.
- Unit-test client code paths that can produce an empty query.
- Treat empty custom={} as no criterion, because the server does.
When it happens
Trigger: Calling livechat/contact with no query params; passing custom={} (empty JSON object); passing custom as an empty string; passing only unrelated params like count/offset.
Common situations: Client code branching forgets to attach a criterion; empty search box submitted straight to the API; integrations probing the endpoint for health checks without params.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- error-invalid-params-custom
- agent-not-found
- error-duplicate-priority-name
- error-forwarding-chat
- error-invalid-contact
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/1a847ab017188de6.
Report an issue: GitHub.
Appendix: source
Thrown at apps/meteor/server/api/v1/omnichannel/contact.ts:93
},
{
async get() {
check(this.queryParams, {
email: Match.Maybe(String),
phone: Match.Maybe(String),
custom: Match.Maybe(String),
});
const { email, phone, custom } = this.queryParams;
let customCF: { [k: string]: string } = {};
try {
customCF = custom && JSON.parse(custom);
} catch (e) {
throw new Meteor.Error('error-invalid-params-custom');
}
if (!email && !phone && !Object.keys(customCF).length) {
throw new Meteor.Error('error-invalid-params');
}
const foundCF = await (async () => {
if (!custom) {
return {};
}
const cfIds = Object.keys(customCF);
const customFields = await LivechatCustomField.findMatchingCustomFieldsByIds(cfIds, 'visitor', true, {
projection: { _id: 1 },
}).toArray();
return Object.fromEntries(customFields.map(({ _id }) => [`livechatData.${_id}`, new RegExp(escapeRegExp(customCF[_id]), 'i')]));
})();
const contact = await LivechatVisitors.findOneByEmailAndPhoneAndCustomField(email, phone, foundCF);
return API.v1.success({ contact });View on GitHub (pinned to b2c16d5842)