Discord.js: BITFIELD_INVALID error on hasPermission

Created on 31 Oct 2019  Â·  3Comments  Â·  Source: discordjs/discord.js

Please describe the problem you are having in as much detail as possible:
Having this issue using GuildMember.hasPermission

Include a reproducible code sample here, if possible:

guildMember.hasPermission("ADMINISTRATOR")

Issue:

Code : BITFIELD_INVALID
RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number.
at Function.resolve (/home/koyamie/Koya/node_modules/discord.js/src/util/BitField.js:150:11)
at Permissions.has (/home/koyamie/Koya/node_modules/discord.js/src/util/BitField.js:45:28)
at Permissions.has (/home/koyamie/Koya/node_modules/discord.js/src/util/Permissions.js:38:85)
at /home/koyamie/Koya/node_modules/discord.js/src/structures/GuildMember.js:263:47
at Map.some (/home/koyamie/Koya/node_modules/@discordjs/collection/dist/index.js:194:17)
at GuildMember.hasPermission (/home/koyamie/Koya/node_modules/discord.js/src/structures/GuildMember.js:263:23)
at /home/koyamie/Koya/koyabot.js:143:69
at new Promise (<anonymous>)

Further details:

  • discord.js version: lastest master
  • Node.js version: 12.13.0
  • Operating system: debian 9
  • Priority this issue should have – please be realistic and elaborate if possible: High
  • [x] I have also tested the issue on latest master, commit hash:
invalid

Most helpful comment

Copy pasting your coda sample does not give said error.
If i didn't miss anything, in order to get that error, whatever you passed as parameter had to be none of number, BitField, array or a string that would be listed in https://github.com/discordjs/discord.js/blob/master/src/util/Permissions.js#L77

Ok so MANAGE_SERVER changed to MANAGE_GUILD when I updated the repo, my bad then didnt noticed, thank you (closing issue)

All 3 comments

Copy pasting your coda sample does not give said error.
If i didn't miss anything, in order to get that error, whatever you passed as parameter had to be none of number, BitField, array or a string that would be listed in https://github.com/discordjs/discord.js/blob/master/src/util/Permissions.js#L77

Copy pasting your coda sample does not give said error.
If i didn't miss anything, in order to get that error, whatever you passed as parameter had to be none of number, BitField, array or a string that would be listed in https://github.com/discordjs/discord.js/blob/master/src/util/Permissions.js#L77

Ok so MANAGE_SERVER changed to MANAGE_GUILD when I updated the repo, my bad then didnt noticed, thank you (closing issue)

thanks! really needed this

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Blumlaut picture Blumlaut  Â·  3Comments

xCuzImPro picture xCuzImPro  Â·  3Comments

tom-barnes picture tom-barnes  Â·  3Comments

LLamaFTL picture LLamaFTL  Â·  3Comments

BrandonCookeDev picture BrandonCookeDev  Â·  3Comments