{"record":{"id":"1c470736364f1bea","repo":"RocketChat/Rocket.Chat","slug":"error-invalid-param","errorCode":"error-invalid-param","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/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/server/api/v1/email-inbox.ts#L128-L164","documentation":"Thrown by GET email-inbox/:_id when the '_id' URL parameter is empty/falsy. It is thrown as a plain Error (not Meteor.Error), so the string 'error-invalid-param' is both the code and the message — there is no human-readable detail. The route already requires the manage-email-inbox permission, so reaching this throw means auth passed but the path segment was blank.","triggerScenarios":"Calling 'email-inbox/' with an empty id segment; client routing bug strips the id; trailing slash producing an empty match.","commonSituations":"Client builds the URL from an undefined variable; copy-paste of the route without substituting the id; framework that drops empty path params.","solutions":["Provide a non-empty _id in the path: GET /api/v1/email-inbox/<id>.","Validate the id is a non-empty string before constructing the URL."],"exampleFix":"// before\nfetch(`/api/v1/email-inbox/${maybeId}`) // maybeId may be undefined\n// after\nif (!maybeId) throw new Error('inbox id required');\nfetch(`/api/v1/email-inbox/${encodeURIComponent(maybeId)}`)","handlingStrategy":"validation","validationCode":"if (!_id || typeof _id !== 'string') throw new Error('email-inbox id required');\nconst url = `/api/v1/email-inbox/${encodeURIComponent(_id)}`;","typeGuard":"function isInboxId(s): s is string { return typeof s === 'string' && s.length > 0; }","tryCatchPattern":"try { await getEmailInbox(_id); }\ncatch (e) {\n  if (e?.message === 'error-invalid-param') { /* fix caller to pass an id */) }\n  else throw e;\n}","preventionTips":["Always URL-encode and require a non-empty id segment.","Treat an empty id as a programmer error, not a runtime retry."],"tags":["email-inbox","validation","rest-api"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}