Pumpkin-MC/Pumpkin · error

invalid player input flag

Error message

invalid player input flag {flag}

What it means

Thrown when an individual player input flag VarInt in a PlayerAuthInput packet falls outside 0..66 (or, in the immediately following check, duplicates a flag already set in the Bitset<66>). Flag values are indices into the 66-bit input bitmap, so out-of-range values indicate malformed data. The decoder returns an InvalidData error.

Solutions

  1. Check that client and server protocol versions (and thus flag enums) match
  2. Log the offending flag value to map it against the current flag enum
  3. Ensure the preceding count field parsed correctly (guards against earlier desync)
  4. Update the flag enum in pumpkin-protocol if a newer protocol redefined indices

Example fix

// before
let flag = VarInt(-3);
// after
let flag = VarInt(5); // must be within 0..66 and not already set
Defensive patterns

Strategy: validation

Validate before calling

fn input_flag_ok(flag: i32, seen: &Bitset<66>) -> bool { (0..66).contains(&flag) && !seen.get(flag as usize) }

Type guard

fn to_flag(v: i32) -> Option<usize> { usize::try_from(v).ok().filter(|&f| f < 66) }

Try / catch

if let Err(e) = PlayerAuthInput::read(reader) {
    if e.to_string().contains("invalid player input flag") { log_bad_input(peer, &e); return Ok(()); }
    return Err(e.into());
}

Prevention

When it happens

Trigger: A client sends a PlayerAuthInput with a flag id < 0 or >= 66 (or the same flag twice); caused by malformed/fuzzed packets, modified clients, or stream misalignment from an earlier bad length/count read.

Common situations: Version skew between client and server flag enumerations, cheat or bot clients emitting raw flag values, packet corruption over unreliable transport.

Understand the failure class

Background: "unknown output mode", "invalid value for flag", "expects true/false": fixing invalid flag value errors in CLI tools — this error's family across 24 libraries.

Related errors


AI-assisted analysis of Pumpkin-MC/Pumpkin@8d4639e25a (2026-09-09). Data as JSON: /api/errors/783aac9118a9c437. Report an issue: GitHub.

Appendix: source

Thrown at crates/pumpkin-protocol/src/bedrock/server/player_auth_input.rs:58

    fn read<R: Read>(reader: &mut R) -> Result<Self, Error> {
        let pitch = f32::read(reader)?;
        let yaw = f32::read(reader)?;
        let position = Vector3::<f32>::read(reader)?;
        let move_vec = Vector2::<f32>::read(reader)?;
        let head_yaw = f32::read(reader)?;
        let mut input_data = Bitset::<66>::default();
        if bool::read(reader)? {
            let count = VarUInt::read(reader)?.0;
            if count > 66 {
                return Err(Error::new(
                    ErrorKind::InvalidData,
                    format!("too many player input flags: {count}"),
                ));
            }
            for _ in 0..count {
                let flag = VarInt::read(reader)?.0;
                if !(0..66).contains(&flag) {
                    return Err(Error::new(
                        ErrorKind::InvalidData,
                        format!("invalid player input flag {flag}"),
                    ));
                }
                if input_data.get(flag as usize) {
                    return Err(Error::new(
                        ErrorKind::InvalidData,
                        format!("duplicate player input flag {flag}"),
                    ));
                }
                input_data.set(flag as usize, true);
            }
        }
        let input_mode = VarUInt::read(reader)?;
        let play_mode = VarUInt::read(reader)?;
        let interaction_model = VarInt::read(reader)?;
        let interact_pitch = f32::read(reader)?;
        let interact_yaw = f32::read(reader)?;

View on GitHub (pinned to 8d4639e25a)