moeru-ai/airi · error · Error

The gamepad deadzone must be from 0 to less than 1.

Error message

The gamepad deadzone must be from 0 to less than 1.

What it means

createStandardGamepadSnapshot validates the caller-supplied `options.deadzone` before using it in applyRadialDeadzone. The value must be finite and in [0, 1). NaN/Infinity (including a non-numeric override), negative values, and values >= 1 would either poison stick math or completely swallow all stick input, so the function rejects them up front with this sentinel validation error.

Source

Thrown at packages/input-gamepad/src/standard-gamepad.ts:123

  const deadzone = options?.deadzone ?? 0.12
  if (!Number.isFinite(deadzone) || deadzone < 0 || deadzone >= 1)
    throw new Error('The gamepad deadzone must be from 0 to less than 1.')

  return {
    buttons: createButtonStates(gamepad.buttons),
    family: detectGamepadFamily(gamepad.id),
    id: gamepad.id,
    index: gamepad.index,
    leftStick: applyRadialDeadzone(gamepad.axes[0] ?? 0, gamepad.axes[1] ?? 0, deadzone),
    rightStick: applyRadialDeadzone(gamepad.axes[2] ?? 0, gamepad.axes[3] ?? 0, deadzone),
    timestamp: gamepad.timestamp,
  }

View on GitHub (pinned to 9c213115f8)

Solutions

  1. Pass a deadzone in [0, 1), e.g. `{ deadzone: 0.12 }`, or omit the option to use the built-in default of 0.12.
  2. Check the configured value where the options object is built (settings UI, config file) and clamp or reject it there.
  3. Use a bounded input control (number input with min 0, max 0.99) so invalid values cannot reach this function.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/input-gamepad/src/standard-gamepad.ts:123 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of moeru-ai/airi@9c213115f8 (2026-09-02). Data as JSON: /api/errors/262e3db5594925e2. Report an issue: GitHub.