RocketChat/Rocket.Chat · error · Meteor.Error
error-roomId-param-invalid
error-roomId-param-invalid
Error message
The "updatedSince" query parameter must be a valid date.
What it means
Thrown by GET /api/v1/permissions.listAll when the optional `updatedSince` query param is present but Date.parse cannot interpret it. Note the error code is misleading legacy reuse: 'error-roomId-param-invalid' has nothing to do with rooms here — the actual problem is a malformed date string such as '2024-13-01', 'yesterday', or a double-encoded ISO timestamp.
Solutions
- Always send an ISO-8601 string produced by new Date().toISOString() (e.g. 2024-05-01T12:00:00.000Z)
- If you store last-sync time, persist the ISO string verbatim rather than reformatting it
- URL-encode the value so timezone pluses survive transport (encodeURIComponent)
Example fix
// before
const url = `permissions.listAll?updatedSince=${lastSync}`; // 'last sync'
// after
const url = `permissions.listAll?updatedSince=${encodeURIComponent(new Date(lastSyncMs).toISOString())}`; Defensive patterns
Strategy: validation
Validate before calling
const updatedSince = new Date(lastSyncMs).toISOString();
if (Number.isNaN(Date.parse(updatedSince))) throw new Error('bad updatedSince cursor');
await sdk.get('permissions.listAll', { updatedSince: encodeURIComponent(updatedSince) }); Type guard
const isValidDateString = (v: unknown): v is string => typeof v === 'string' && v.length > 0 && !Number.isNaN(Date.parse(v));
Try / catch
catch the 400 and inspect body.error — despite the misleading 'error-roomId-param-invalid' code, only updatedSince is at fault; rebuild it with toISOString() and retry once.
Prevention
- Always generate timestamps with toISOString()
- Encode query values with encodeURIComponent so '+' timezones survive
- Store sync cursors as ISO strings or epoch millis, never preformatted local strings
When it happens
Trigger: GET /api/v1/permissions.listAll?updatedSince=<bad> with values like '01/02/2024' being sent without timezone care, non-ISO strings ('now', 'last-week'), or an ISO string mangled by URL encoding (spaces/%2B becoming '+' and being stripped). Omitting updatedSince entirely is fine — the error only fires when the param exists and Date.parse returns NaN.
Common situations: Client builds the date with locale-dependent formatting instead of toISOString(); a '+' in the timezone offset gets decoded to a space by the query parser, making the string unparseable; synced clients that last-run timestamps as raw epoch numbers or human strings.
Related errors
- error-invalid-param
- error-not-allowed
- error-param-not-provided
- error-roomid-param-not-provided
- error-roomid-param-not-provided
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/24d6f76a37fb9287.
Report an issue: GitHub.
Appendix: source
Thrown at apps/meteor/server/api/v1/permissions.ts:125
type: 'boolean',
enum: [true],
description: 'Indicates if the request was successful.',
},
},
required: ['update', 'remove', 'success'],
additionalProperties: false,
}),
400: validateBadRequestErrorResponse,
401: validateUnauthorizedErrorResponse,
},
},
async function action() {
const { updatedSince } = this.queryParams;
let updatedSinceDate: Date | undefined;
if (updatedSince) {
if (isNaN(Date.parse(updatedSince))) {
throw new Meteor.Error('error-roomId-param-invalid', 'The "updatedSince" query parameter must be a valid date.');
}
updatedSinceDate = new Date(updatedSince);
}
const result = (await permissionsGetMethod(updatedSinceDate)) as {
update: IPermission[];
remove: IPermission[];
};
if (Array.isArray(result)) {
return API.v1.success({
update: result,
remove: [],
});
}
return API.v1.success(result);
},View on GitHub (pinned to b2c16d5842)