sxyazi/yazi · error
Invalid MoveOptStep data type: {value:?}
Error message
Invalid MoveOptStep data type: {value:?} What it means
`MoveOptStep`'s `TryFrom<&Data>` impl accepts only a String (parsed via FromStr, e.g. "half-page", "-1", "100%"-style specs) or an Integer (interpreted as a line count). Any other Data variant — Bool, Number (float), List, Map, Null — bails with "Invalid MoveOptStep data type: {value:?}", including the value's Debug form.
Source
Thrown at yazi-widgets/src/input/parser/move.rs:82
"eol" => Self::Eol,
"first-char" => Self::FirstChar,
s => Self::Offset(s.parse()?),
})
}
}
impl From<isize> for MoveOptStep {
fn from(value: isize) -> Self { Self::Offset(value) }
}
impl TryFrom<&Data> for MoveOptStep {
type Error = anyhow::Error;
fn try_from(value: &Data) -> Result<Self, Self::Error> {
Ok(match value {
Data::String(s) => s.parse()?,
Data::Integer(i) => Self::from(*i as isize),
_ => bail!("Invalid MoveOptStep data type: {value:?}"),
})
}
}
View on GitHub (pinned to 5f901b886b)
Solutions
- Pass the step as an integer (line count) or a recognized string form (e.g. "half-page").
- Check the keymap/Lua call site and correct the argument's type; remove surrounding tables/lists.
- For fractional scrolling, round to an integer or use the string preset instead of a float.
- For absent optional steps, omit the key and rely on the handler's default rather than passing nil.
Example fix
// before
-- keymap: { run = 'input move 1.5' } -> Data::Number -> invalid
// after
{ run = 'input move 1' } -- integer
-- or
{ run = 'input move half-page' } -- string preset Defensive patterns
Strategy: validation
Validate before calling
fn valid_step(d: &Data) -> bool {
match d {
Data::String(s) => s.parse::<MoveOptStep>().is_ok(),
Data::Integer(_) => true,
_ => false,
}
} Type guard
fn is_step_data(d: &Data) -> bool {
matches!(d, Data::String(_) | Data::Integer(_))
} Try / catch
let step = MoveOptStep::try_from(&data).unwrap_or(MoveOptStep::from(1));
Prevention
- Pass steps as integers or preset strings (e.g. "half-page"), never floats/bools/nil.
- In keymap config, quote string presets and keep counts integral.
- Validate config command args at load time with valid_step().
- Round fractional scroll amounts to integers at the Lua boundary.
When it happens
Trigger: Passing a non-string/non-integer value where a step spec is expected — e.g. `Data::Number(1.5)`, `Data::Bool(true)`, or a missing (Null) argument converted via `TryFrom<&Data>` in input-widget movement handling (cursor move by step).
Common situations: Keymap/config `input` movement bindings where the step argument is a float or boolean instead of an integer or string like "half-page"; Lua plugin calls passing numbers with fractional parts or nil; typos in config that leave the argument as a table.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- command name cannot be empty
- Cannot parse cache stamp: {e}
- Invalid cache stamp
- {e}
- Invalid condition: {expr}
AI-assisted analysis of sxyazi/yazi@5f901b886b (2026-09-02).
Data as JSON: /api/errors/53ec389c0f8718a0.
Report an issue: GitHub.