{"record":{"id":"ebe277bb25e9b027","repo":"RocketChat/Rocket.Chat","slug":"error-updatedsince-param-invalid-ebe277","errorCode":"error-updatedSince-param-invalid","errorMessage":"The \"updatedSince\" query parameter must be a valid date.","messagePattern":"The \"updatedSince\" query parameter must be a valid date\\.","errorType":"exception","errorClass":"Meteor.Error","httpStatus":400,"severity":"error","filePath":"apps/meteor/server/api/v1/rooms.ts","lineNumber":248,"sourceCode":"\t\t\t\tproperties: {\n\t\t\t\t\tupdate: { type: 'array', items: { type: 'object' } }, // relaxed: IRoom composed with lastMessage\n\t\t\t\t\tremove: { type: 'array', items: { type: 'object' } }, // relaxed: IRoom composed with lastMessage\n\t\t\t\t\tsuccess: { type: 'boolean', enum: [true] },\n\t\t\t\t},\n\t\t\t\trequired: ['update', 'remove', 'success'],\n\t\t\t\tadditionalProperties: false,\n\t\t\t}),\n\t\t\t400: validateBadRequestErrorResponse,\n\t\t\t401: validateUnauthorizedErrorResponse,\n\t\t},\n\t},\n\tasync function action() {\n\t\tconst { updatedSince } = this.queryParams;\n\n\t\tlet updatedSinceDate;\n\t\tif (updatedSince) {\n\t\t\tif (isNaN(Date.parse(updatedSince))) {\n\t\t\t\tthrow new Meteor.Error('error-updatedSince-param-invalid', 'The \"updatedSince\" query parameter must be a valid date.');\n\t\t\t} else {\n\t\t\t\tupdatedSinceDate = new Date(updatedSince);\n\t\t\t}\n\t\t}\n\n\t\tlet result = await roomsGetMethod(this.userId, updatedSinceDate);\n\n\t\tif (Array.isArray(result)) {\n\t\t\tresult = {\n\t\t\t\tupdate: result,\n\t\t\t\tremove: [],\n\t\t\t};\n\t\t}\n\n\t\treturn API.v1.success({\n\t\t\tupdate: await Promise.all(result.update.map((room) => composeRoomWithLastMessage(room, this.userId))),\n\t\t\tremove: await Promise.all(result.remove.map((room) => composeRoomWithLastMessage(room, this.userId))),\n\t\t});","sourceCodeStart":230,"sourceCodeEnd":266,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/e4b8178b205510181a96ceefee043d0abcd13e5a/apps/meteor/server/api/v1/rooms.ts#L230-L266","documentation":"Thrown by GET /api/v1/rooms.get when the updatedSince query parameter is present but Date.parse(updatedSince) returns NaN, i.e. the string is not a parseable date. The endpoint expects an ISO 8601 timestamp and uses it to return only rooms updated after that instant (plus removed rooms). Any locale-specific or non-standard format risks rejection.","triggerScenarios":"GET rooms.get?updatedSince=1650000000000 (epoch milliseconds as a string, not parseable); updatedSince=18/08/2026 (locale format); a truncated timestamp like 2026-08-18T12:60:00Z; sending a timezone name like UTC.","commonSituations":"Passing Date.now() output directly instead of new Date().toISOString(); client libraries formatting dates per user locale; database timestamps copied as epoch numbers; timezone-less local formats like 2026-08-18 14:30 (parseable in most engines but non-portable).","solutions":["Always send ISO 8601 UTC: new Date().toISOString() (e.g. 2026-08-18T12:00:00.000Z)","Convert epoch values before sending: new Date(epochMs).toISOString()","Validate client-side with Number.isNaN(Date.parse(value)) and fix before the request","Omit updatedSince entirely when you want the full room list snapshot"],"exampleFix":"// before\nawait sdk.get('rooms.get', { updatedSince: String(Date.now()) }); // epoch millis -> NaN parse\n\n// after\nawait sdk.get('rooms.get', { updatedSince: new Date().toISOString() }); // 2026-08-18T12:00:00.000Z","handlingStrategy":"validation","validationCode":"if (updatedSince && Number.isNaN(Date.parse(updatedSince))) {\n  updatedSince = new Date(updatedSinceEpochMs).toISOString();\n}","typeGuard":null,"tryCatchPattern":"try {\n  await sdk.get('rooms.get', { updatedSince });\n} catch (e: any) {\n  if (e?.response?.data?.errorType === 'error-updatedSince-param-invalid') {\n  return sdk.get('rooms.get', { updatedSince: new Date().toISOString() }); // one-shot fallback\n  }\n  throw e;\n}","preventionTips":["Centralize date serialization: every outbound timestamp goes through toISOString()","Never pass Date.now() output directly as updatedSince","Add a lint/test assertion on the query builder for ISO format"],"tags":["rooms","date-format","rest-api","query-params"],"backgroundTag":"invalid-date-format","analyzedSha":"e4b8178b205510181a96ceefee043d0abcd13e5a","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}