Files
nushell/tests/shell
Luc PerkinsandClaude Opus 5.5 836bb49df3 Make error output for missing environment variables more specific (#19529)
## Description

Fixes #8543 by changing the error output for a missing environment
variable to be more developer friendly.

Currently:

```
  Error: nu::shell::column_not_found

    × Cannot find column 'UNSET_VAR'
     ╭─[entry #1:1:1]
   1 │ $env.UNSET_VAR
     · ────┬───
     ·     ├── column 'UNSET_VAR' is missing in one or more values
     ·     ╰── value originates here
     ╰────
    help: If some rows have this column, try using 'UNSET_VAR?' for optional
          access, or pre-fill using the `default` command
```

Proposed:

```
  Error: nu::shell::env_variable_not_found

    x Environment variable 'UNSET_VAR' not found
     ,-[source:1:1]
   1 | $env.UNSET_VAR
     : ^^^^|^^^
     :     `-- environment variable not found
     `----
    help: use `$env.UNSET_VAR?` to get `null` if it isn't set, or `$env.UNSET_VAR? | default
          <value>` to fall back to a default
```

## User-facing changes (Release notes)

Accessing an unset environment variable, like `$env.UNSET_VAR`, now
raises a `nu::shell::env_variable_not_found` error rather than the more
generic `nu::shell::column_not_found` error, and suggests using a
construction like `$env.UNSET_VAR?` for optional access.

## Additional notes

N/A

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 18:59:34 -06:00
..