Skip to content

finally block suppresses stdout error message from try / catch blocks #17970

@jasha-hrp

Description

@jasha-hrp

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

Adding a finally block after try/catch suppresses printing to stdout of errors raised in the try/catch blocks:
With just try and catch, things are as expected:

$ try { error make { msg: foo } } catch { error make { msg: bar } }
Error: nu::shell::error

  × bar
   ╭─[repl_entry #12:1:52]
 1try { error make { msg: foo } } catch { error make { msg: bar } }
   ·                                                    ────────────
   ╰────

Error:
  × foo
   ╭─[repl_entry #12:1:18]
 1try { error make { msg: foo } } catch { error make { msg: bar } }
   ·                  ────────────
   ╰────

But if you add a finally block, neither error is printed:

$ try { error make { msg: foo } } catch { error make { msg: bar } } finally { print baz }
baz

How to reproduce

$ try { error make { msg: foo } } catch { error make { msg: bar } }
$ try { error make { msg: foo } } catch { error make { msg: bar } } finally { print baz }

Expected behavior

My expectation would be that, in the second case, the same errors should be printed as in the first case (in addition to the string baz printed from the finally block).

Configuration

$ version | transpose key value | to md --pretty

key value
version 0.111.0
major 0
minor 111
patch 0
branch
commit_hash
build_os macos-aarch64
build_target aarch64-apple-darwin
rust_version rustc 1.94.0 (4a4ef493e 2026-03-02)
rust_channel stable-aarch64-apple-darwin
cargo_version cargo 1.94.0 (85eff7c80 2026-01-15)
build_time 2026-03-08 21:17:48 -04:00
build_rust_channel release
allocator standard
features default, mcp, network, plugin, rustls-tls, sqlite, trash-support
installed_plugins highlight 1.4.10+0.108.0, skim 0.10.0
experimental_options example=false, reorder-cell-paths=true, pipefail=true, enforce-runtime-annotations=true, native-clip=true

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: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