RocketChat/Rocket.Chat · warning · 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 as Meteor.Error('error-roomId-param-invalid', 'The "updatedSince" query parameter must be a valid date.') on GET /api/v1/permissions when updatedSince is supplied but Date.parse(updatedSince) is NaN. Note the error code is misleadingly named 'roomId-param-invalid' but the message correctly describes the updatedSince problem - the code is a reused generic param-invalid code, not a permissions-specific one.

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 f9d3ec372b)

Solutions

  1. Send updatedSince as an ISO-8601 timestamp (e.g., new Date().toISOString()).
  2. Validate with !isNaN(Date.parse(value)) client-side before the request.
  3. Omit updatedSince entirely to get the full permission list rather than a delta.

Example fix

// before
fetch(`/api/v1/permissions?updatedSince=${localDateString}`);

// after
const iso = new Date(localDateString).toISOString(); // 'YYYY-MM-DDTHH:mm:ss.sssZ'
fetch(`/api/v1/permissions?updatedSince=${encodeURIComponent(iso)}`);
Defensive patterns

Strategy: validation

Validate before calling

let qs = '';
if (updatedSince) {
  const ms = Date.parse(updatedSince);
  if (Number.isNaN(ms)) throw new Error('updatedSince must be ISO-8601');
  qs = '?updatedSince=' + encodeURIComponent(new Date(ms).toISOString());
}
await fetch('/api/v1/v1/permissions' + qs);

Type guard

function isIsoDate(s: unknown): s is string {
  return typeof s === 'string' && !Number.isNaN(Date.parse(s));
}

Try / catch

null

Prevention

When it happens

Trigger: GET /api/v1/v1/permissions?updatedSince=foo or ?updatedSince=2024-13-45 - any string that is not parseable by Date.parse. ISO-8601 like '2024-01-01T00:00:00.000Z' is the expected format.

Common situations: Client formatting dates with locale strings that Date.parse rejects; passing a Unix epoch number as a string without conversion; trailing timezone garbage.

Related errors


AI-assisted analysis of RocketChat/Rocket.Chat@f9d3ec372b (2026-08-12). Data as JSON: /api/errors/24d6f76a37fb9287. Report an issue: GitHub.