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)


node: v16.19.0
Was this page helpful?