{"record":{"id":"1c470736364f1bea","repo":"RocketChat/Rocket.Chat","slug":"error-invalid-param","errorCode":null,"errorMessage":"error-invalid-param","messagePattern":"error-invalid-param","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/api/v1/email-inbox.ts","lineNumber":146,"sourceCode":"\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\tsuccess: { type: 'boolean', enum: [true] },\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\trequired: ['success'],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t{ type: 'null' },\n\t\t\t\t],\n\t\t\t}),\n\t\t\t401: validateUnauthorizedErrorResponse,\n\t\t\t403: validateForbiddenErrorResponse,\n\t\t\t404: validateNotFoundErrorResponse,\n\t\t},\n\t},\n\tasync function action() {\n\t\tconst { _id } = this.urlParams;\n\t\tif (!_id) {\n\t\t\tthrow new Error('error-invalid-param');\n\t\t}\n\t\tconst emailInbox = await EmailInbox.findOneById(_id);\n\n\t\tif (!emailInbox) {\n\t\t\treturn API.v1.notFound();\n\t\t}\n\n\t\treturn API.v1.success(emailInbox);\n\t},\n);\n\nAPI.v1.delete(\n\t'email-inbox/:_id',\n\t{\n\t\tauthRequired: true,\n\t\tpermissionsRequired: ['manage-email-inbox'],\n\t\tresponse: {\n\t\t\t200: ajv.compile<{ _id: string }>({","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/api/v1/email-inbox.ts#L128-L164","documentation":"Thrown by GET email-inbox/:_id when the _id URL segment is missing/empty: the action destructures this.urlParams._id and throws new Error('error-invalid-param') when falsy before querying EmailInbox.findOneById. Because the route is defined with an :_id path parameter, this normally only fires when the path matched with an empty segment (e.g. trailing slash) — otherwise a missing id yields 404 routing.","triggerScenarios":"Calling GET /api/v1/email-inbox/ (trailing slash, empty segment) or a URL where the _id segment is stripped by client-side path building.","commonSituations":"Template strings that leave the id empty when state is not yet loaded ('/api/v1/email-inbox/' + id with id=''); proxies that normalize away an empty segment; exploratory curl with the path truncated.","solutions":["Always include the id: GET /api/v1/email-inbox/<_id>.","Guard client-side: skip the request when the id is empty instead of sending '/email-inbox/'.","Use email-inbox.list to discover valid _id values when unsure."],"exampleFix":"// before\nfetch(`/api/v1/email-inbox/${id}`); // id may be ''\n\n// after\nif (id) fetch(`/api/v1/email-inbox/${id}`);","handlingStrategy":"validation","validationCode":"function inboxUrl(id: string | undefined) {\n  if (!id) throw new Error('email-inbox _id is required');\n  return `/api/v1/email-inbox/${encodeURIComponent(id)}`;\n}","typeGuard":"const isNonEmptyId = (v: unknown): v is string => typeof v === 'string' && v.length > 0;","tryCatchPattern":null,"preventionTips":["Disable fetch/delete actions until a row with an _id is selected.","Unit-test URL builders with empty and undefined ids."],"tags":["rocketchat","rest-api","email-inbox","path-param","invalid-param"],"backgroundTag":"missing-path-parameter","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}