NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
12.58k stars 1.51k forks source link

Poor diagnostics for set -> string type coercion errors. #561

Open michaelsproul opened 9 years ago

michaelsproul commented 9 years ago

I found this error quite unhelpful:

$ sudo nixos-rebuild test
building Nix...
building the system configuration...
error: cannot coerce a set to a string, at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/types.nix":103:79
(use ‘--show-trace’ to show detailed location information)

The position given for the error is within the NixOS source, so I figured I'd run it again with --show-trace.

$ sudo nixos-rebuild test --show-trace
building Nix...
building the system configuration...
error: while evaluating the attribute ‘config.system.build.toplevel’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/nixos/modules/system/activation/top-level.nix":228:5:
while evaluating ‘fold’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":20:19, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/nixos/modules/system/activation/top-level.nix":122:12:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":27:8:
while evaluating ‘showWarnings’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/nixos/modules/system/activation/top-level.nix":91:18, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/nixos/modules/system/activation/top-level.nix":98:16:
while evaluating ‘fold’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":20:19, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/nixos/modules/system/activation/top-level.nix":91:23:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":27:8:
while evaluating the attribute ‘warnings’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/attrsets.nix":135:44:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":26:45, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/attrsets.nix":135:52:
while evaluating the attribute ‘value’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":206:9:
while evaluating the option `warnings':
while evaluating ‘id’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/trivial.nix":9:8, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":204:15:
while evaluating ‘fold’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":20:19, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":187:12:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":27:8:
while evaluating ‘filterOverrides’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":277:21, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":182:20:
while evaluating ‘concatMap’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":54:18, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":284:8:
while evaluating ‘concatMap’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":54:18, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":110:20:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":110:31, called from undefined position:
while evaluating ‘dischargeProperties’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":247:25, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":112:65:
while evaluating the attribute ‘config."${name}"’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/nixos/modules/system/boot/systemd.nix":891:5:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/attrsets.nix":160:10, called from undefined position:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/nixos/modules/system/boot/systemd.nix":891:51, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/attrsets.nix":160:16:
while evaluating ‘optional’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":105:20, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/nixos/modules/system/boot/systemd.nix":892:7:
while evaluating the attribute ‘serviceConfig.Type’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/attrsets.nix":135:44:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":26:45, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/attrsets.nix":135:52:
while evaluating the attribute ‘value’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":206:9:
while evaluating the option `systemd.services.cron.serviceConfig':
while evaluating ‘id’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/trivial.nix":9:8, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":204:15:
while evaluating ‘fold’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":20:19, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":187:12:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":27:8:
while evaluating ‘filterOverrides’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":277:21, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":182:20:
while evaluating ‘concatMap’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":54:18, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":284:8:
while evaluating ‘concatMap’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":54:18, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":110:20:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":110:31, called from undefined position:
while evaluating ‘dischargeProperties’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":247:25, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":112:65:
while evaluating the attribute ‘condition’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":324:14:
while evaluating the attribute ‘condition’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":324:14:
while evaluating the attribute ‘preStart’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/attrsets.nix":135:44:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":26:45, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/attrsets.nix":135:52:
while evaluating the attribute ‘value’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":206:9:
while evaluating the option `systemd.services.cron.preStart':
while evaluating ‘id’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/trivial.nix":9:8, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":204:15:
while evaluating ‘fold’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":20:19, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":187:12:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":27:8:
while evaluating ‘filterOverrides’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":277:21, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":182:20:
while evaluating ‘concatMap’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":54:18, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":284:8:
while evaluating ‘concatMap’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":54:18, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":110:20:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":110:31, called from undefined position:
while evaluating ‘dischargeProperties’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":247:25, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":112:65:
while evaluating the attribute ‘config."${name}"’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/nixos/modules/services/scheduling/cron.nix":105:9:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/nixos/modules/services/scheduling/cron.nix":28:19, called from undefined position:
while evaluating the attribute ‘text’ of the derivation ‘system-crontab’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/pkgs/build-support/trivial-builders.nix":10:14:
while evaluating the attribute ‘paths’ of the derivation ‘system-path’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/pkgs/build-support/trivial-builders.nix":10:14:
while evaluating the attribute ‘environment.systemPackages’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/attrsets.nix":135:44:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":26:45, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/attrsets.nix":135:52:
while evaluating the attribute ‘value’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":206:9:
while evaluating the option `environment.systemPackages':
while evaluating ‘id’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/trivial.nix":9:8, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":204:15:
while evaluating ‘fold’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":20:19, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:11:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":27:8:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":197:22, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘check’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/types.nix":112:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix":198:16:
while evaluating ‘fold’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":20:19, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/types.nix":112:38:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":27:8:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":94:24, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":94:24, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":94:24, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":94:24, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":94:24, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘fold'’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":23:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:34:
while evaluating anonymous function at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":94:24, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":26:14:
while evaluating ‘check’ at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/types.nix":103:15, called from "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/lists.nix":94:30:
cannot coerce a set to a string, at "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/types.nix":103:79

Eventually I traced the error to my use of ghc (a set) rather than ghc.ghc784 (a package) in environment.systemPackages. The trace fails to mention ghc, its contents or its location in the configuration file (/etc/nixos/configuration:64). Ideally, I would have liked an error like this:

error: expected a value of type 'package' in 'environment.systemPackages' but received 'ghc' of type 'set' at "/etc/nixos/configuration":64:5
vcunat commented 9 years ago

These can get very ugly. Right now the evaluator with --show-trace only output

error: value is a string while a set was expected

and no trace at all. It took me hours before I found where the problem was, among the thousands of (texlive) packages.

Mathnerd314 commented 9 years ago

Using my latest noisy-nix commits (https://github.com/NixOS/nix/pull/612) the errors show as follows:

$ ~/nix/inst/bin/nix-instantiate . --eval --show-trace --strict -A pkgs.texlive.scheme-full
error: while evaluating the attribute ‘pkgs’ at ~/nixpkgs-test/pkgs/tools/typesetting/tex/texlive-new/default.nix:104:7-104:11:
while evaluating list position ‘10928’:
while evaluating a black hole:
value is a string at ~/nixpkgs-test/pkgs/tools/typesetting/tex/texlive-new/bin.nix:17:15-17:19 while a set was expected at ~/nixpkgs-test/pkgs/tools/typesetting/tex/texlive-new/default.nix:113:15-113:65

$ ~/nix/inst/bin/nix-instantiate --show-trace -E 'with import ./nixos/default.nix { configuration = (a @ {pkgs, ...}: (import /etc/nixos/configuration.nix a) // { environment.systemPackages = [ pkgs.haskellPackages ]; }); }; system'
...
while evaluating the attribute ‘pkgs’ of the derivation ‘system-path’ at ~/nixpkgs-test/pkgs/build-support/buildenv/default.nix:38:5-38:9:
while evaluating a black hole at ~/nixpkgs-test/pkgs/build-support/buildenv/default.nix:38:5-38:9:
while calling primop toJSON at ~/nixpkgs-test/pkgs/build-support/buildenv/default.nix:38:12-41:14:
while evaluating list position ‘250’ at ~/nixpkgs-test/pkgs/build-support/buildenv/default.nix:38:12-41:14:
while evaluating the attribute ‘paths’ at ~/nixpkgs-test/pkgs/build-support/buildenv/default.nix:39:7-39:12:
while evaluating list position ‘0’ at ~/nixpkgs-test/pkgs/build-support/buildenv/default.nix:39:7-39:12:
while calling anonymous function at ~/nixpkgs-test/lib/types.nix:117:14-117:24 from ~/nixpkgs-test/pkgs/build-support/buildenv/default.nix:39:7-39:12:
while evaluating the attribute ‘value’ at ~/nixpkgs-test/lib/types.nix:117:17-117:24:
while evaluating a black hole at ~/nixpkgs-test/lib/types.nix:117:17-117:24:
while calling primop foldl' at ~/nixpkgs-test/lib/modules.nix:314:19-317:43:
while calling anonymous function at ~/nixpkgs-test/lib/modules.nix:314:32-316:96 from ~/nixpkgs-test/lib/modules.nix:314:19-317:43:
while calling ‘check’ at ~/nixpkgs-test/lib/types.nix:97:15-97:49 from ~/nixpkgs-test/lib/modules.nix:315:10-315:30:
while calling ‘isStorePath’ at ~/nixpkgs-test/lib/strings.nix:224:17-224:112 from ~/nixpkgs-test/lib/types.nix:97:36-97:49:
while calling primop substring at ~/nixpkgs-test/lib/strings.nix:224:20-224:55:
while evaluating a black hole at ~/nixpkgs-test/lib/strings.nix:224:20-224:55:
while calling primop toString at ~/nixpkgs-test/lib/strings.nix:224:44-224:54:
cannot coerce a set at (string):1:132-1:152 to a string at ~/nixpkgs-test/lib/strings.nix:224:44-224:54

Maybe someone will want to review them...

michaelsproul commented 9 years ago

@Mathnerd314: That looks quite a bit better.

domenkozar commented 8 years ago

Similar: https://github.com/NixOS/nix/issues/963

freddie-freeloader commented 7 years ago

I get this error, for my configuration.nix. I have about 250 values in there. :sob:

It's obviously time to tidy up, but until then:

Are there any debugging tactics to track the problematic value down? :pray:

bjornfor commented 7 years ago

I have use binary search. Comment out half of the file, test, repeat.

freddie-freeloader commented 7 years ago

Reminds me of:

Nix won't be complete until it has static typing.

:wink:

stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info

scintill commented 3 years ago

bump to unstalify

milahu commented 3 years ago

Are there any debugging tactics to track the problematic value down?

do a manual stack trace, by inserting dozens of

{
  # TRACE
  #someAttr = "some value";
  someAttr =
    lib.traceSeqN 2 { loc = "line 1234"; someAttr = "some value"; }
    "some value"
  ;
}

... to get a feel for the program flow

make --show-trace more verbose

Is your feature request related to a problem? Please describe. I'm always frustrated when ... ... i have an error in my code, but --show-trace is too short for debugging

Describe the solution you'd like --show-trace should be more verbose, it should list all function calls, similar to the stack traces in java or javascript

Describe alternatives you've considered use lib.traceSeq and friends, to manually locate the error in my code

Additional context

4000

stale[bot] commented 2 years ago

I marked this as stale due to inactivity. → More info

zhaofengli commented 1 year ago

The trace is even worse if you accidentally attempt to access an attset with attrset as a key (e.g., hashes.${stdenv.hostPlatform}):

let
  attr = { foo = "bar"; };
  key = {};
in attr.${key}
$ nix-instantiate --version
nix-instantiate (Nix) 2.13.3

$ nix-instantiate --eval bad-trace.nix --show-trace
error: value is a set while a string was expected

       at «none»:0: (source not available)

Same with 2.3:

$ nix-instantiate --version
nix-instantiate (Nix) 2.3.16

$ nix-instantiate --eval bad-trace.nix --show-trace
error: value is a set while a string was expected