{"record":{"id":"5812bcfe3c24521d","repo":"paperclipai/paperclip","slug":"discord-bot-needs-view-channels-send-messages-cr","errorCode":null,"errorMessage":"Discord bot needs View Channels, Send Messages, Create Public Threads, Send Messages in Threads, Read Message History, Add Reactions, Embed Links, and Attach Files in at least one text channel","messagePattern":"Discord bot needs View Channels, Send Messages, Create Public Threads, Send Messages in Threads, Read Message History, Add Reactions, Embed Links, and Attach Files in at least one text channel","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/src/services/chat-discord.ts","lineNumber":323,"sourceCode":"        memberRoleIds,\n        roles,\n      });\n      return (\n        (permissions & REQUIRED_CHANNEL_PERMISSIONS) ===\n        REQUIRED_CHANNEL_PERMISSIONS\n      );\n    })\n    .sort((left, right) => (left.position ?? 0) - (right.position ?? 0))\n    .map((channel) => ({\n      providerResourceId: channel.id!,\n      parentProviderResourceId: guildId,\n      type: \"channel\",\n      label: channel.name ? `#${channel.name}` : channel.id!,\n      providerUrl: `https://discord.com/channels/${guildId}/${channel.id}`,\n      metadata: { source: \"provider_inventory\" },\n    }));\n  if (resources.length === 0) {\n    throw new Error(\n      \"Discord bot needs View Channels, Send Messages, Create Public Threads, Send Messages in Threads, Read Message History, Add Reactions, Embed Links, and Attach Files in at least one text channel\",\n    );\n  }\n  return { provider: \"discord\", resources };\n}\n","sourceCodeStart":305,"sourceCodeEnd":329,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/server/src/services/chat-discord.ts#L305-L329","documentation":"After fetching channels and computing effective permissions (guild @everyone base permissions adjusted by role and member overwrites), listDiscordBotChannels filters text channels (type 0) where the bot holds all REQUIRED_CHANNEL_PERMISSIONS. If no channel satisfies the full permission set, there is nowhere the bot can post, so the function throws with the exact permission list needed.","triggerScenarios":"listDiscordBotChannels succeeds at fetching guild/member/roles/channels, but for every type-0 channel the computed permissions bitmask is missing at least one of: View Channels, Send Messages, Create Public Threads, Send Messages in Threads, Read Message History, Add Reactions, Embed Links, Attach Files.","commonSituations":"Bot invited with the default 'bot' scope but no permission checkboxes ticked; server admins applied role/channel denies that strip Send Messages or View Channels everywhere; all channels are private (type != 0 visible to bot, or bot role lacks access); @everyone role denies View Channels and the bot has no roles granting it.","solutions":["Re-invite the bot with the required permissions (View Channels, Send Messages, Create Public Threads, Send Messages in Threads, Read Message History, Add Reactions, Embed Links, Attach Files) via the OAuth2 URL with a permissions value covering those bits","In Discord Server Settings, grant the bot's role these permissions on at least one text channel (channel-level overwrites are fine)","Check per-channel permission overwrites that deny View Channels or Send Messages for the bot's role and remove/allow them","Ensure at least one channel is a public text channel (type 0) the bot can see — the inventory only considers type-0 channels"],"exampleFix":"// before: default invite, no permissions requested\nhttps://discord.com/api/oauth2/authorize?client_id=...&scope=bot\n// after: request the needed permissions\nhttps://discord.com/api/oauth2/authorize?client_id=...&scope=bot&permissions=35803776 (ViewChannel|SendMessages|CreatePublicThreads|SendMessagesInThreads|ReadMessageHistory|AddReactions|EmbedLinks|AttachFiles)","handlingStrategy":"validation","validationCode":"const REQUIRED = BigInt(0x400 | 0x800 | 0x40000 | 0x100000 | 0x10000 | 0x40 | 0x4000 | 0x8000);\n// verify via the API: compute effective perms for each text channel the bot can see;\n// if none satisfies REQUIRED, show the setup URL with those permission bits before calling listDiscordBotChannels","typeGuard":null,"tryCatchPattern":"try {\n  const inv = await listDiscordBotChannels({ botUserId, botToken, fetch, guildId });\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith(\"Discord bot needs View Channels\")) {\n    redirectToBotInviteUrl({ guildId, permissions: \"35803776\" });\n  } else throw err;\n}","preventionTips":["Always invite the bot with an explicit permissions= integer covering all eight required permission bits","Document the required channel permissions in setup UI before the inventory step runs","After role changes on the server, re-run the channel inventory to catch newly denied channels"],"tags":["discord","permissions","configuration","integration"],"backgroundTag":"insufficient-permissions","analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-09-10T03:14:50.855Z","contentChangedAt":"2026-09-10T03:14:50.855Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}