Skip to content

Confusing error message when running script that couldn't find the shebang exe #15970

Closed

Description

@wonrax

Describe the bug

If the shebang executable could not be found, nushell will throw an error with a confusing message and a reference to the unhelpful Rust code.

~/scripts >: ./setup-links.sh
Error: nu::shell::io::not_found

  × Not found
  ╰─▶   × Could not spawn foreground child

   ╭────
 1 │ crates/nu-command/src/system/run_external.rs:284:17
   · ─────────────────────────┬─────────────────────────
   ·                          ╰── Not found
   ╰────

This is how bash reports the error which I think is clearer:

[~/scripts]$ ./setup-links.sh
bash: ./setup-links.sh: cannot execute: required file not found

How to reproduce

  1. Create a script with a nonexistent shebang executable
  2. Invoke the script inside nushell

Expected behavior

Clear and concise error message

Configuration

key value
version 0.104.0
major 0
minor 104
patch 0
branch
commit_hash
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.86.0 (05f9846f8 2025-03-31) (built from a source tarball)
cargo_version cargo 1.86.0 (adf9b6ad1 2025-02-28)
build_time 1980-01-01 00:00:00 +00:00
build_rust_channel release
allocator standard
features default, sqlite, trash
installed_plugins

Activity

  1. added
    status:needs-triage
    on Jun 15, 2025
  2. added
    A:error-unhelpful
    on Jun 15, 2025
  3. wonrax commented on Jun 17, 2025

    @wonrax
    Author

    This is how fish reports the error, however we can only do the same if we're safe to assume that the errno returned by Command::spawn is from libc::execvp.

    https://github.com/fish-shell/fish-shell/blob/06578bd03d2d/src/fork_exec/postfork.rs#L229-L518

    I can work on this if it's safe to make the assumption, otherwise this might be a architectural change since we have to implement the Command::spawn ourselves using libc like fish does.

  4. GunnerGuyven commented on Oct 29, 2025

    @GunnerGuyven

    This also happens when a dependency is missing in a binary executable that can be identified by ldd. This same error message appears.

  5. added
    A:external-commands
    on Oct 29, 2025
  6. added this to the v0.117.0 milestone on Oct 19, 2026
  7. added a commit that references this issue on Oct 19, 2026
    877ed65
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:error-unhelpfulA:external-commandsstatus:needs-triage

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions