Skip to content

Inaccurate error message when using negative index in cell path #18281

Closed

Description

@guluo2016

Bug report form

  • 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

  1. Executing command [["A", "B"], ["1", "2"]] | get 0.-1 or [1, 2, 3] | regect (-1) in nushell, the following error message is inaccurate.
  2. × Row number too large

Expected behavior

See the bug description above for details.
I think the error message should accurately describe the actual issue.

Configuration

Key Value
version 0.112.2
major 0
minor 112
patch 2
branch
commit_hash d80ee8c
build_os windows-x86_64
build_target x86_64-pc-windows-msvc
rust_version rustc 1.92.0 (ded5c06cf 2025-12-08)
rust_channel 1.92.0-x86_64-pc-windows-msvc
cargo_version cargo 1.92.0 (344c4567c 2025-10-21)
build_time 2026-04-15 21:31:35 +00:00
build_rust_channel release
allocator standard
features default, mcp, network, plugin, rustls-tls, sqlite, trash-support
installed_plugins
experimental_options example=false, reorder-cell-paths=true, pipefail=true, enforce-runtime-annotations=false, native-clip=false, cell-path-types=false

Activity

  1. added
    status:needs-triage
    on May 25, 2026
  2. added a commit that references this issue on Jun 1, 2026
    53b805c
  3. added this to the v0.114.0 milestone on Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status:needs-triage

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions