Bad diagnostic for interpolating null into a string #665

Open
opened 2025-02-10 23:56:58 +00:00 by jade · 0 comments
Owner
$ nix build -L --expr 'builtins.derivation { jacked = "${null}"; system = "aarch64-darwin"; name = "foo6"; builder = "/bin/sh"; args = ["-c" "> $out"]; }'                          
error:
       … while evaluating an expression to select 'drvPath' on it
         at «internal»:1:552:
       … while calling the 'derivationStrict' builtin
         at «internal»:1:208:
       (stack trace truncated; use '--show-trace' to show the full trace)

       error: cannot coerce null to a string: null

Without being jade and having seen this 1000 times and knowing that "coerce to a string" means "${...}", it is really hard to know what is actually broken. The message needs some copy editing to actually say what was being done there: it should say something about interpolating into a string. This error message also has a side of #239 and #664, since the stack trace is worthless.

``` $ nix build -L --expr 'builtins.derivation { jacked = "${null}"; system = "aarch64-darwin"; name = "foo6"; builder = "/bin/sh"; args = ["-c" "> $out"]; }' error: … while evaluating an expression to select 'drvPath' on it at «internal»:1:552: … while calling the 'derivationStrict' builtin at «internal»:1:208: (stack trace truncated; use '--show-trace' to show the full trace) error: cannot coerce null to a string: null ``` Without being jade and having seen this 1000 times and knowing that "coerce to a string" means "${...}", it is really hard to know what is actually broken. The message needs some copy editing to actually say what was being done there: it should say something about *interpolating* into a string. This error message also has a side of https://git.lix.systems/lix-project/lix/issues/239 and https://git.lix.systems/lix-project/lix/issues/664, since the stack trace is worthless.
jade added this to the Error reporting project 2025-02-10 23:56:58 +00:00
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#665
No description provided.