Debugging 'anonymous lambda' called with unexpected argument

When updating a flake input from nixos 22.11 to 23.11 this error appears

nix develop .#
       … while calling the 'derivationStrict' builtin

         at /builtin/derivation.nix:9:12: (source not available)

       … while evaluating derivation 'nix-shell'
         whose name attribute is located at /nix/store/yy19v2dwb8ldphvia9smajvwv3ycx2c1-source/pkgs/stdenv/generic/make-derivation.nix:348:7

       … while evaluating attribute 'buildInputs' of derivation 'nix-shell'

         at /nix/store/yy19v2dwb8ldphvia9smajvwv3ycx2c1-source/pkgs/stdenv/generic/make-derivation.nix:395:7:

          394|       depsHostHost                = elemAt (elemAt dependencies 1) 0;
          395|       buildInputs                 = elemAt (elemAt dependencies 1) 1;
             |       ^
          396|       depsTargetTarget            = elemAt (elemAt dependencies 2) 0;

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: function 'anonymous lambda' called with unexpected argument 'auditable'

       at /nix/store/rcgf3bz9ip8skmaamgbx3q5np1fcfy2q-source/rust-overlay.nix:294:24:

          293|     mkProfile = name: profileComponents:
          294|       makeOverridable ({ extensions, targets, targetExtensions }:
             |                        ^
          295|         mkAggregated {

How should I go about understanding what the problem is and how to solve it?

I struggle to relate the error message to anything over which I have control. Yes, the flake uses rust-overlay which is mentioned in the message, but I have no idea what auditable is. Adding --show-trace spews lots of information, including that cargo-auditable-0.6.1 is involved, so that is likely to be where ‘auditable’ comes from. But I don’t see how my code is influencing how this is used, so I don’t see what I might be able to do to investigate or fix this.

1 Like

Somewhere in the rust-overlay (the error suggests line 294), a lambda function is defined. (Look at mkProfile, is a function that takes “name” and returns a lambda function that takes “profileComponents” which in turn returns a lambda function,…)

Somewhere in the call stack auditable is passed into this construction, but is not listed in the arguments, hence the error: “called with unexpected argument”.

Indeed, but given that most of this call stack is a consequence of the interaction between my dependencies (probably nixpkgs and rust-overlay), how can get some idea of whether this is caused by me doing something wrong, or because of a bug in the dependencies, or something else?

The argument names expected on line 294 (inside rust-overlay.nix) are extensions, targets and targetExtensions (no auditable).

rust-overlay.nix is the only file on the stack that does not come from nixpkgs. Searching for auditable = in nixpkgs finds only 2 matches, both in the same file:

It seems that these two lines were added on 2022-12-04, so they will appear in my attempted transition from 22.11 to 23.11.

This suggests an incompatibility between nixpkgscargo-auditable and rust-overlay, but I find it hard to believe that this has not been noticed in over a year (I have bumped the flake lock on my rust-overlay to 2024-01-18). So perhaps I was doing something wrong in my flake but got away with it by sheer luck until now?