Skip to content

load-env very flaky & yields unexpected results #7149

@theAkito

Description

@theAkito

Describe the bug

I've been playing around with load-env and noticed unexpected behaviour.

  1. If one entry fails in any way, for example if a variable cannot be resolved, the entire load-env block is completely dismissed.
  2. If an entire load-env block is dismissed due to an error of any kind, this all happens silently. The user does not get any message about it failing. In fact, it has to be specifically looked up or the user has to notice by accident how an environment variable is missing, even though it exists in the load-env block.
  3. "Compiling" the file with the load-env block does work and does not complain. No errors, no warnings, nothing.

How to reproduce

  1. Open a Nu file. For example, test_load-env.nu.
  2. Create a load-env block.
  3. Assign an unresolvable (environment) variable to one of the record keys.
  4. source test_load-env.nu
  5. Try to resolve any record from the load-env block. None will be available and you didn't notice until now.

Expected behavior

Either an error should be shown on "compile" time and interrupt the compilation process, or every record should be evaluated, except the faulty one and an error or warning should be shown.

The most important point is the communication of what happened. The user must know, that something isn't right.

Screenshots

No response

Configuration

key value
version 0.71.0
branch
commit_hash 6cc4ef6
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.65.0 (897e37553 2022-11-02)
rust_channel stable-x86_64-unknown-linux-gnu
cargo_version cargo 1.65.0 (4bc8f24d3 2022-10-20)
pkg_version 0.71.0
build_time 2022-11-08 18:00:26 +00:00
build_rust_channel release
features database, dataframe, default, trash, which, zip
installed_plugins partial

Additional context

Platform
Debian GNU/Linux 11 (bullseye) in WSL2 on Windows 10

Terminal software
Visual Studio Code integrated Terminal

Nushell is running "natively" as a login shell.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:error-silent-failCases where nothing or something bad happens and an error would be helpful and expectedA:error-unhelpfulThe error message you observe is not helpful to identify the problem

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions