Skip to content

Cannot always ignore errors with do -i #16494

@axelkar

Description

@axelkar

Describe the bug

~> [0] | each { try { ^false } }
╭────────────╮
│ empty list │
╰────────────╯
~> [0] | each { do -i { ^false } }
Error: nu::shell::eval_block_with_input

  × Eval block failed with pipeline input
   ╭─[entry #12:1:2]
 1 │ [0] | each { do -i { ^false } }
   ·  ┬
   ·  ╰── source value
   ╰────

Error: nu::shell::non_zero_exit_code

  × External command had a non-zero exit code
   ╭─[entry #12:1:23]
 1 │ [0] | each { do -i { ^false } }
   ·                       ──┬──
   ·                         ╰── exited with code 1
   ╰────

How to reproduce

[0] | each { try { ^false } } # doesn't fail
[0] | each { do -i { ^false } } # fails

Expected behavior

do -i should also catch non_zero_exit_code when in each

Configuration

key value
version 0.106.1
major 0
minor 106
patch 1
branch
commit_hash
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.88.0 (6b00bc388 2025-06-23) (built from a source tarball)
cargo_version cargo 1.88.0 (873a06493 2025-05-10)
build_time 1980-01-01 00:00:00 +00:00
build_rust_channel release
allocator standard
features default, plugin, rustls-tls, sqlite, trash-support
installed_plugins
experimental_options example=false, reorder-cell-paths=false

Metadata

Metadata

Assignees

No one assigned

    Labels

    error-handlingHow errors in externals/nu code are caught or handled programmatically (see also unhelpful-error)needs-triageAn issue that hasn't had any proper look

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions