nushell / nushell/nushell

getting a column that is missing a row gives unhelpful error

Open
#11,215 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Describe the bug

as per title

How to reproduce
  1. try getting a column in a table where a row is missing said column
[{a: 1, b: 2}, {a: 3}] | get b
Expected behavior

the error thrown above will be

Error: nu::shell::column_not_found

  × Cannot find column
   ╭─[entry #1:1:1]
 1 │ [{a: 1, b: 2}, {a: 3}] | get b
   ·                ───┬──        ┬
   ·                   │          ╰── cannot find column 'b'
   ·                   ╰── value originates here
   ╰────

but because [{a: 1, b: 2}, {a: 3}] | columns gives [a, b], i would expect the error to tell that one of the row is missing one of the field in the table.
maybe with the row id of the first one that is missing the field?

Screenshots

No response

Configuration
key value
version 0.87.1
branch
commit_hash
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.73.0 (cc66ad468 2023-10-03)
rust_channel stable-x86_64-unknown-linux-gnu
cargo_version cargo 1.73.0 (9c4383fb5 2023-08-26)
build_time 2023-11-21 18:26:35 +01:00
build_rust_channel release
allocator mimalloc
features default, sqlite, trash, which, zip
installed_plugins clipboard copy, clipboard paste, gstat, notify, nu_plugin_explore
Additional context

No response

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 running the reported Nushell pipeline and compare its error with the result of columns. Trace the get handling and the column_not_found diagnostic; done should be an error that explains that a row is missing the requested field, ideally identifying the first affected row.

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
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.