RocketChat/Rocket.Chat · error · Meteor.Error
error-roomId-param-invalid
error-roomId-param-invalid
Error message
The "${paramName}" query parameter must be a valid date. What it means
Thrown by GET emoji-custom.list when the updatedSince or _updatedAt query parameter cannot be parsed as a JavaScript Date (new Date(paramValue) yields NaN). The server needs a real date to build the MongoDB _updatedAt: { $gt: date } filter for incremental sync, so an unparseable value is rejected with HTTP 400. Note the error code is misleadingly named 'error-roomId-param-invalid' (legacy copy from rooms endpoints) even though it concerns date params on emoji-custom.list.
Solutions
- Send the date as ISO 8601 / RFC 3339 UTC, e.g. updatedSince=2024-12-31T23:59:59.000Z (new Date().toISOString() on the client)
- If you do not need incremental sync, omit updatedSince and _updatedAt entirely - empty/absent params are skipped
- Check the raw value that reaches the server (log this.queryParams) for stray quotes, spaces, or percent-encoding artifacts and URL-encode properly
- If you store epoch seconds, convert before sending: new Date(epochMs).toISOString(), do not send the bare number string
Example fix
// before
const res = await sdk.get('emoji-custom.list', { updatedSince: '31/12/2024' });
// after
const res = await sdk.get('emoji-custom.list', { updatedSince: new Date('2024-12-31T00:00:00Z').toISOString() }); Defensive patterns
Strategy: validation
Validate before calling
function toIsoDate(value) {
if (!value) return undefined;
const ms = Date.parse(value);
if (Number.isNaN(ms)) throw new Error(`updatedSince is not a parseable date: ${value}`);
return new Date(ms).toISOString();
}
// use: sdk.get('emoji-custom.list', { updatedSince: toIsoDate(lastSync) }) Type guard
const isParsableDateString = (v: unknown): v is string => typeof v === 'string' && v.length > 0 && !Number.isNaN(Date.parse(v));
Try / catch
try { await sdk.get('emoji-custom.list', { updatedSince }); } catch (e) {
if (e.error === 'error-roomId-param-invalid') { /* re-send with new Date().toISOString() */ }
} Prevention
- Always serialize dates with toISOString() at the HTTP boundary, never toLocaleString()
- Centralize query-string building in one client helper that type-checks date fields
- Treat empty string and absent as the same thing: skip the param instead of sending ''
When it happens
Trigger: Calling GET /api/v1/emoji-custom.list?updatedSince=31/12/2024 (DD/MM/YYYY, not parseable as date), ?updatedSince=yesterday, ?updatedSince=2024-13-45, or a double-encoded value like %272024-01-01%27 that arrives with quote characters. Passing an empty string does NOT trigger it (empty is treated as absent); only non-empty unparseable strings do.
Common situations: Client scripts formatting dates with locale-specific formats instead of ISO 8601; teams syncing emoji changes since a stored local timestamp; copy-pasting a timestamp from Mongo shell (e.g. ISODate(...) or epoch seconds as a bare number-string like 1718000000, which some JS engines reject); URL-encoding bugs that inject whitespace or quotes around the value.
Understand the failure class
Background: "Invalid query parameter" / "Failed to parse value of ...": fixing bad query string parameters across APIs — this error's family across 36 libraries.
Related errors
- The " .end" query parameter must be a valid date.
- The " .start" query parameter must be a valid date.
- emoji-is-not-image
- Emoji not found.
- error-invalid-date
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/766267498db208fb.
Report an issue: GitHub.
Appendix: source
Thrown at apps/meteor/server/api/v1/emoji-custom.ts:59
});
const emojiCustomDeleteResponseSchema = ajv.compile<void>({
type: 'object',
properties: {
success: { type: 'boolean', enum: [true] },
},
required: ['success'],
additionalProperties: false,
});
function validateDateParam(paramName: string, paramValue: string | undefined): Date | undefined {
if (!paramValue) {
return undefined;
}
const date = new Date(paramValue);
if (isNaN(date.getTime())) {
throw new Meteor.Error('error-roomId-param-invalid', `The "${paramName}" query parameter must be a valid date.`);
}
return date;
}
const emojiCustomListResponseSchema = ajv.compile<{
emojis: { update: IEmojiCustom[]; remove: WithId<RocketChatRecordDeleted<IEmojiCustom>>[] };
}>({
type: 'object',
properties: {
emojis: {
type: 'object',
properties: {
update: { type: 'array', items: { type: 'object' } },
remove: { type: 'array', items: { type: 'object' } },
},
required: ['update', 'remove'],
},View on GitHub (pinned to b2c16d5842)