title: RangeError [BITFIELD_INVALID] when checking for permission overwrites (Discord.js v12)
body: <p>I was trying to create a lock command where the user can select what permission gets overwritten. However, this only works if the 3rd and 4th <code>if</code> statements (which check for existing permission overwrites) are removed as the following error is produced: <code>RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number.</code> Would there be a workaround for this?</p>
  <pre><code>const channel = bot.channels.cache.get(args[0]);
  
        if(!channel) {
          return message.reply('Please provide a channel id!');
        }
  
        if(!args[1]) {
          return message.reply('Please set the lock type!');
        }
  
        if (!channel.permissionsFor(message.guild.roles.everyone).has('VIEW_CHANNEL')) {
          const errorEmbed = new Discord.MessageEmbed()
            .setDescription(`❌ \`VIEW_CHANNEL\` for \`${channel.name}\` is already disabled.`)
            .setColor('RED');
          return message.channel.send(errorEmbed);
        }
  
        if (!channel.permissionsFor(message.guild.roles.everyone).has('READ_MESSAGES')) {
          const errorEmbed = new Discord.MessageEmbed()
            .setDescription(`❌ \`READ_MESSAGES\` for \`${channel.name}\` is already disabled.`)
            .setColor('RED');
          return message.channel.send(errorEmbed);
        }
  
        else if (args[1] === 'view' || args[1] === 'read') {
          channel.updateOverwrite(message.channel.guild.roles.everyone, { VIEW_CHANNEL: false }).then(() =&gt; {
            const msgEmbed = new Discord.MessageEmbed()
              .setDescription(`✅ The channel\`${message.channel.name}\` has been locked.`)
              .setColor('GREEN');
            message.channel.send(msgEmbed);
          }).catch((error) =&gt; {
            console.log(error);
            const errorEmbed = new Discord.MessageEmbed()
              .setDescription(`❌ Unable to lock \`${channel.name}\`.`)
              .setColor('RED');
            message.channel.send(errorEmbed);
          });
        }
        else if (args[1] === 'send') {
          channel.updateOverwrite(message.channel.guild.roles.everyone, { SEND_MESSAGES: false }).then(() =&gt; {
            const msgEmbed = new Discord.MessageEmbed()
              .setDescription(`✅ The channel\`${channel.name}\` has been locked.`)
              .setColor('GREEN');
            message.channel.send(msgEmbed);
          }).catch((error) =&gt; {
            console.log(error);
            const errorEmbed = new Discord.MessageEmbed()
              .setDescription(`❌ Unable to lock \`${channel.name}\`.`)
              .setColor('RED');
            message.channel.send(errorEmbed);
          });
        }
  </code></pre>