Home Explore Blog CI



nix

3rd chunk of `doc/manual/source/release-notes/rl-2.20.md`
f8e8febeadff5cefcaf98d7f9ade41632077fbacee1a61e1000000010000086f
    = «thunk»; darwinMinVersionVariable = «thunk»; darwinPlatform = «thunk»; «84
    attributes elided»}
  ```

- Type errors include the failing value

  In errors like `value is an integer while a list was expected`, the message now
  includes the failing value.

  Before:

  ```
  error: value is a set while a string was expected
  ```

  After:

  ```
  error: expected a string but found a set: { ghc810 = «thunk»;
    ghc8102Binary = «thunk»; ghc8107 = «thunk»; ghc8107Binary = «thunk»;
    ghc865Binary = «thunk»; ghc90 = «thunk»; ghc902 = «thunk»; ghc92 = «thunk»;
    ghc924Binary = «thunk»; ghc925 = «thunk»;  «17 attributes elided»}
  ```

- Source locations are printed more consistently in errors [#561](https://github.com/NixOS/nix/issues/561) [#9555](https://github.com/NixOS/nix/pull/9555)

  Source location information is now included in error messages more
  consistently. Given this code:

  ```nix
  let
    attr = {foo = "bar";};
    key = {};
  in
    attr.${key}
  ```

  Previously, Nix would show this unhelpful message when attempting to evaluate
  it:

  ```
  error:
         … while evaluating an attribute name

         error: value is a set while a string was expected
  ```

  Now, the error message displays where the problematic value was found:

  ```
  error:
         … while evaluating an attribute name

           at bad.nix:4:11:

              3|   key = {};
              4| in attr.${key}
               |           ^
              5|

         error: expected a string but found a set
  ```

- Some stack overflow segfaults are fixed [#9616](https://github.com/NixOS/nix/issues/9616) [#9617](https://github.com/NixOS/nix/pull/9617)

  The number of nested function calls has been restricted, to detect and report
  infinite function call recursions. The default maximum call depth is 10,000 and
  can be set with [the `max-call-depth`
  option](@docroot@/command-ref/conf-file.md#conf-max-call-depth).

  This replaces the `stack overflow (possible infinite recursion)` message.

- Better error reporting for `with` expressions [#9658](https://github.com/NixOS/nix/pull/9658)

Title: Improved Error Reporting in Nix 2.20.0
Summary
Nix 2.20.0 introduces several improvements to error reporting. It now consistently includes source location information in error messages, providing more context for debugging. Stack overflow errors due to infinite recursion are now handled by restricting the number of nested function calls and reporting them with a clearer message. A new `max-call-depth` option is introduced to configure the maximum call depth. Finally, there are improvements in error reporting for `with` expressions.