{"record":{"id":"d3d97f7d448f8b12","repo":"RocketChat/Rocket.Chat","slug":"error-invalid-channel-d3d97f","errorCode":"error-invalid-channel","errorMessage":"Invalid Channel","messagePattern":"Invalid Channel","errorType":"validation","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/lib/integrations/lib/validateOutgoingIntegration.ts","lineNumber":60,"sourceCode":"\t\t});\n\t}\n\n\tintegration.urls = integration.urls.filter((url) => url && url.trim() !== '');\n\n\tif (integration.urls.length === 0) {\n\t\tthrow new Meteor.Error('error-invalid-urls', 'Invalid URLs', {\n\t\t\tfunction: 'validateOutgoing._verifyRequiredFields',\n\t\t});\n\t}\n}\n\nasync function _verifyUserHasPermissionForChannels(userId: IUser['_id'], channels: string[]): Promise<void> {\n\tfor (let channel of channels) {\n\t\tif (scopedChannels.includes(channel)) {\n\t\t\tif (channel === 'all_public_channels') {\n\t\t\t\t// No special permissions needed to add integration to public channels\n\t\t\t} else if (!(await hasPermissionAsync(userId, 'manage-outgoing-integrations'))) {\n\t\t\t\tthrow new Meteor.Error('error-invalid-channel', 'Invalid Channel', {\n\t\t\t\t\tfunction: 'validateOutgoing._verifyUserHasPermissionForChannels',\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\tlet record;\n\t\t\tconst channelType = channel[0];\n\t\t\tchannel = channel.substr(1);\n\n\t\t\tswitch (channelType) {\n\t\t\t\tcase '#':\n\t\t\t\t\trecord = await Rooms.findOne({\n\t\t\t\t\t\t$or: [{ _id: channel }, { name: channel }],\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\tcase '@':\n\t\t\t\t\trecord = await Users.findOne({\n\t\t\t\t\t\t$or: [{ _id: channel }, { username: channel }],\n\t\t\t\t\t});","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/lib/integrations/lib/validateOutgoingIntegration.ts#L42-L78","documentation":"Thrown by _verifyUserHasPermissionForChannels when a channel entry is one of the workspace-wide scope tokens 'all_private_groups' or 'all_direct_messages' but the creating user lacks the manage-outgoing-integrations permission. Listening across every private group or DM is privileged, so only users holding that permission may register such an integration; 'all_public_channels' is explicitly exempt and needs no permission.","triggerScenarios":"A non-admin calls integrations.create/update with channel containing 'all_private_groups' or 'all_direct_messages' (case-sensitive as written in the channel CSV) while their role lacks manage-outgoing-integrations.","commonSituations":"Power users trying to mirror all DMs or private channels into an external tool; permission sets cloned from a bot role that never included integration management; forgetting that only the public-channel scope is unprivileged.","solutions":["Grant the creator's role manage-outgoing-integrations (Admin -> Permissions), then retry","Or scope the integration to explicit channels ('#private-room') the user belongs to instead of the all_* token","Use 'all_public_channels' when public-channel coverage is enough — it requires no permission"],"exampleFix":"// before — non-admin, workspace-wide private scope\n{ channel: 'all_private_groups' }\n\n// after — grant the permission, or list rooms explicitly\n// Admin -> Permissions -> role 'user' -> manage-outgoing-integrations = On\n{ channel: '#private-room' }","handlingStrategy":"validation","validationCode":"const privilegedScopes = ['all_private_groups', 'all_direct_messages'];\nif (channels.some((c) => privilegedScopes.includes(c)) && !(await hasPermissionAsync(userId, 'manage-outgoing-integrations'))) {\n  throw new Error('all_private_groups / all_direct_messages require manage-outgoing-integrations');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check the creator's permissions before offering the all_private_groups / all_direct_messages options in the UI","Prefer explicit channel lists or all_public_channels for non-admin users"],"tags":["integrations","outgoing-webhook","permissions","channels"],"backgroundTag":"insufficient-permissions","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}