Repository navigation
Description
Describe the bug
If a try/try-catch block is piped from, and a command inside the try block returns an error in a streaming fashion, then the error escapes the try block.
How to reproduce
try {
open --raw $nu.current-exe | lines
} | where trueresults in an error message about the file not being utf-8.
Expected behavior
I expected errors inside the try block to not propagate outside the try block, though it's not clear exactly what the correct behavior should be. Note that
try {
open --raw $nu.current-exe | lines | where true
}does not print an error message (as expected). It is only when the try block is piped from that the error escapes.
Also note that a non-streaming error such as
try {
open /does/not/exist | lines
} | echo $indoes not print an error message either. In this case I used echo $in rather than where true because where does not accept empty pipelines.
My suggestion for the behavior in the case of streaming errors with try blocks is as follows: Using a try block would cause errors to be ignored (like do -i), while using a try catch block would cause the catch block to be used to generate a replacement value each time an error is encountered. There are surely other reasonable things that could be done though.
However, the current behavior makes try blocks occasionally ineffective for reasons that aren't obvious to anyone who doesn't know about PipelineData and the fact that errors are a type of Value, and so I feel as though it counts as a bug.
Configuration
| key | value |
|---|---|
| version | 0.105.1 |
| major | 0 |
| minor | 105 |
| patch | 1 |
| branch | |
| commit_hash | |
| build_os | macos-x86_64 |
| build_target | x86_64-apple-darwin |
| rust_version | rustc 1.89.0-nightly (bf64d66bd 2025-05-21) |
| rust_channel | nightly-x86_64-apple-darwin |
| cargo_version | cargo 1.89.0-nightly (47c911e9e 2025-05-14) |
| build_time | 2025-06-23 19:42:48 -04:00 |
| build_rust_channel | release |
| allocator | standard |
| features | default, sqlite, trash |
| installed_plugins |
Activity
kronberger-droid commentedon Nov 16, 2026
The
linescase from this report no longer errors, sincelinesis lossy now.The underlying problem is still there on 0.117:
fails with
boom, while the same with acatchor withwhereinside thetryis caught.