Error using GuildMember.roles.add()

when i use GuildMember.roles.add, the bot can add the role to member, but this error appears I've already checked the id, and it's the right role id
/home/nicolas/Projetos/decorators.d.js/node_modules/discord.js/src/managers/GuildMemberRoleManager.js:37
return this.guild.roles.cache.filter(role => this.member._roles.includes(role.id)).set(everyone.id, everyone);
^

TypeError: Cannot read properties of undefined (reading 'id')
at GuildMemberRoleManager.get cache (/home/nicolas/Projetos/decorators.d.js/node_modules/discord.js/src/managers/GuildMemberRoleManager.js:37:101)
at GuildMemberRoleManager.add (/home/nicolas/Projetos/decorators.d.js/node_modules/discord.js/src/managers/GuildMemberRoleManager.js:134:31)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
/home/nicolas/Projetos/decorators.d.js/node_modules/discord.js/src/managers/GuildMemberRoleManager.js:37
return this.guild.roles.cache.filter(role => this.member._roles.includes(role.id)).set(everyone.id, everyone);
^

TypeError: Cannot read properties of undefined (reading 'id')
at GuildMemberRoleManager.get cache (/home/nicolas/Projetos/decorators.d.js/node_modules/discord.js/src/managers/GuildMemberRoleManager.js:37:101)
at GuildMemberRoleManager.add (/home/nicolas/Projetos/decorators.d.js/node_modules/discord.js/src/managers/GuildMemberRoleManager.js:134:31)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
node: v16.19.0
4 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Sexus Prime
Sexus PrimeOP2y ago
MrMythical
MrMythical2y ago
Enable Guilds intent
Sexus Prime
Sexus PrimeOP2y ago
thanks broo 👍🏽
Want results from more Discord servers?
Add your server