You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Inaccurate error message when using negative index in cell path #18281
I have done a basic search of the issue tracker to find any existing issues that are similar.
I have checked that my version is at least the latest stable release available via my installation method.
Describe the bug
When accessing a list cell with a negative index like [["A", "B"], ["1", "2"]] | get 0.-1, nushell returns error messageRow number too large (max: 1).
I think this error message is inaccurate, as -1 is not a too large value.
The root cause is that the parsed i64 value -1 is cast directly to usize via val as usize in crates/nu-parser/src/parser.rs, causing it to wrap to usize::MAX.
The subsequent bounds check then fails and reports Row number too large (max: 1), which is inaccurate because the actual input is a negative value rather than an excessively large one.
How to reproduce
Executing command [["A", "B"], ["1", "2"]] | get 0.-1 or [1, 2, 3] | regect (-1) in nushell, the following error message is inaccurate.
× Row number too large
Expected behavior
See the bug description above for details.
I think the error message should accurately describe the actual issue.
Activity
Inaccurate error message when using negative index in cell path (#18282)