Skip to content

(#17448) Update label and help text on CantFindCol error - #18108

Merged
fdncred merged 2 commits into
nushell:mainfrom
colinmparker:better-cantfindcol-err
Apr 24, 2026
Merged

fdncred merged 2 commits into
nushell:mainfrom
colinmparker:better-cantfindcol-err

Conversation

@colinmparker

@colinmparker colinmparker commented Apr 23, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR addresses issue #17448. It improves the CantFindColumn error by being more precise about missing data and suggesting workarounds with optional access and the default command.

Please review the language, it may be too verbose or too specific to table-style access.

Example:

$ [{b: 2}, {a: 0, b: 1}] | select a
Error: nu::shell::column_not_found

  × Cannot find column 'a'
   ╭─[source:1:2]
 1 │ [{b: 2}, {b: 3}, {a: 0, b: 1}] | select a
   ·  ───┬──                                 ┬
   ·     │                                   ╰── column 'a' is missing in one or more values
   ·     ╰── value originates here
   ╰────
  help: If some rows have this column, try using 'a?' for optional access, or pre-fill using
        the `default` command

User-facing changes (Release notes)

  • Improved language for the "Cannot find column ..." shell error to be more precise about missing data and suggest user actions to fix.

be more precise about missing data
suggest workarounds with optional access and `default`
@fdncred
fdncred merged commit c892a0e into nushell:main Apr 24, 2026
18 checks passed
@fdncred

fdncred commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Thanks!

@github-actions github-actions Bot added this to the v0.113.0 milestone Apr 24, 2026
@fdncred fdncred added notes:ready Indicates Ready for Release notes notes:other Noted in "Other changes" section labels May 5, 2026
fdncred pushed a commit that referenced this pull request Nov 20, 2026
## Description

Follow-up to #18108 for #17448.

`rename --column` could report that a column was missing from the entire
input when only a later record lacked it.

```nu
[{name: Alice} {age: 30}] | rename -c {name: n}
```

The error now labels `rename` with `cannot rename column 'name'`. The
existing highlight on `{age: 30}` now says `row 1 is missing column
'name'`. The error code is `nu::shell::unsupported_input`.

## User-facing changes (Release notes)

`rename --column` now reports the zero-based index of the input row that
is missing a requested column.

## Additional notes

- Added regression coverage for a missing column in a later record and
in a single record, the highlighted record span, and a successful mapped
rename.
- On macOS, seven rename integration tests and three rename unit tests
passed. Formatting, both Clippy checks, Typos, and `git diff --check`
also passed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

notes:other Noted in "Other changes" section notes:ready Indicates Ready for Release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants