bevyengine/bevy · error · ButtonSettingsError

invalid release_threshold {0}, expected value [0.0..=1.0]

Error message

invalid release_threshold {0}, expected value [0.0..=1.0]

What it means

ButtonSettingsError validation variant: release_threshold was outside the required 0.0..=1.0 range. The release threshold is the axis value below which a pressed button is considered released; it must be less than or equal to press_threshold.

Source

Thrown at crates/bevy_input/src/gamepad.rs:325

    },
    ///  Parameter `deadzone_upperbound` was not less than or equal to parameter `livezone_upperbound`.
    #[error("invalid parameter values livezone_upperbound {} deadzone_upperbound {}, expected deadzone_upperbound <= livezone_upperbound", livezone_upperbound, deadzone_upperbound)]
    DeadZoneUpperBoundGreaterThanLiveZoneUpperBound {
        /// The value of the `livezone_upperbound` parameter.
        livezone_upperbound: f32,
        /// The value of the `deadzone_upperbound` parameter.
        deadzone_upperbound: f32,
    },
    /// The given parameter was not in range 0.0..=2.0.
    #[error("invalid threshold {0}, expected 0.0 <= threshold <= 2.0")]
    Threshold(f32),
}

/// Errors that occur when setting button settings for gamepad input.
#[derive(Error, Debug, PartialEq)]
pub enum ButtonSettingsError {
    /// The given parameter was not in range 0.0..=1.0.
    #[error("invalid release_threshold {0}, expected value [0.0..=1.0]")]
    ReleaseThresholdOutOfRange(f32),
    /// The given parameter was not in range 0.0..=1.0.
    #[error("invalid press_threshold {0}, expected [0.0..=1.0]")]
    PressThresholdOutOfRange(f32),
    /// Parameter `release_threshold` was not less than or equal to `press_threshold`.
    #[error("invalid parameter values release_threshold {} press_threshold {}, expected release_threshold <= press_threshold", release_threshold, press_threshold)]
    ReleaseThresholdGreaterThanPressThreshold {
        /// The value of the `press_threshold` parameter.
        press_threshold: f32,
        /// The value of the `release_threshold` parameter.
        release_threshold: f32,
    },
}

/// Stores a connected gamepad's metadata such as the name and its [`GamepadButton`] and [`GamepadAxis`].
///
/// An entity with this component is spawned automatically after [`GamepadConnectionEvent`]
/// and updated by [`gamepad_event_processing_system`].

View on GitHub (pinned to 396ca72708)

Solutions

  1. Clamp release_threshold to [0.0, 1.0]
  2. Validate user-provided settings before constructing GamepadButtonSettings
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/bevy_input/src/gamepad.rs:325 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of bevyengine/bevy@396ca72708 (2026-08-20). Data as JSON: /api/errors/67aa58a09a48698c. Report an issue: GitHub.