nushell / nushell/nushell

Cannot always ignore errors with `do -i`

Open
#16,494 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A:error-handling status:needs-triage
Dominant language
Rust
Stars
40.5k
Forks
2.3k
Avg merge
1d 14h
Merged PRs (30d)
79

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the two commands in the issue, comparing try { ^false } with do -i { ^false } inside each. Trace how do -i handles pipeline input and non-zero external-command errors. Done means do -i catches non_zero_exit_code in each as shown by the expected behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.