{"record":{"id":"53ec389c0f8718a0","repo":"sxyazi/yazi","slug":"invalid-moveoptstep-data-type-value","errorCode":null,"errorMessage":"Invalid MoveOptStep data type: {value:?}","messagePattern":"Invalid MoveOptStep data type: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"yazi-widgets/src/input/parser/move.rs","lineNumber":82,"sourceCode":"\t\t\t\"eol\" => Self::Eol,\n\t\t\t\"first-char\" => Self::FirstChar,\n\t\t\ts => Self::Offset(s.parse()?),\n\t\t})\n\t}\n}\n\nimpl From<isize> for MoveOptStep {\n\tfn from(value: isize) -> Self { Self::Offset(value) }\n}\n\nimpl TryFrom<&Data> for MoveOptStep {\n\ttype Error = anyhow::Error;\n\n\tfn try_from(value: &Data) -> Result<Self, Self::Error> {\n\t\tOk(match value {\n\t\t\tData::String(s) => s.parse()?,\n\t\t\tData::Integer(i) => Self::from(*i as isize),\n\t\t\t_ => bail!(\"Invalid MoveOptStep data type: {value:?}\"),\n\t\t})\n\t}\n}\n","sourceCodeStart":64,"sourceCodeEnd":86,"githubUrl":"https://github.com/sxyazi/yazi/blob/5f901b886b14de1f17460b6e52e9de5d67f8aba9/yazi-widgets/src/input/parser/move.rs#L64-L86","documentation":"`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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"// before\n-- keymap: { run = 'input move 1.5' }  -> Data::Number -> invalid\n// after\n{ run = 'input move 1' }        -- integer\n-- or\n{ run = 'input move half-page' } -- string preset","handlingStrategy":"validation","validationCode":"fn valid_step(d: &Data) -> bool {\n    match d {\n        Data::String(s) => s.parse::<MoveOptStep>().is_ok(),\n        Data::Integer(_) => true,\n        _ => false,\n    }\n}","typeGuard":"fn is_step_data(d: &Data) -> bool {\n    matches!(d, Data::String(_) | Data::Integer(_))\n}","tryCatchPattern":"let step = MoveOptStep::try_from(&data).unwrap_or(MoveOptStep::from(1));","preventionTips":["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."],"tags":["rust","parsing","widgets","yazi-widgets"],"backgroundTag":"invalid-argument-value","analyzedSha":"5f901b886b14de1f17460b6e52e9de5d67f8aba9","analyzedAt":"2026-09-02T18:38:25.566Z","contentChangedAt":"2026-09-02T18:38:25.566Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}