Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unclear error message when a function is passed to with #934

Open
domenkozar opened this issue Jun 10, 2016 · 7 comments
Open

Unclear error message when a function is passed to with #934

domenkozar opened this issue Jun 10, 2016 · 7 comments
Assignees
Labels
error-messages Confusing messages and better diagnostics good first issue Quick win for first-time contributors idea approved The given proposal has been discussed and approved by the Nix team. An implementation is welcome. language The Nix expression language; parser, interpreter, primops, evaluation, etc

Comments

@domenkozar
Copy link
Member

domenkozar commented Jun 10, 2016

This often happens due to careless usage of with (import lib) where lib file is a function.

Current behaviour

$ cat foo.nix 
with (a: a);

a
$ nix-build foo.nix 
error: value is a function while a set was expected

Expected behaviour

I'd expect the error message to be:

error: value is a function while a set was expected in with statement, at /home/ielectric/dev/nixpkgs/foo.nix:1:5
@domenkozar
Copy link
Member Author

cc @edolstra

@domenkozar domenkozar changed the title Unclear error message when function is passed to with Unclear error message when a function is passed to with Jun 10, 2016
@shlevy shlevy added the backlog label Apr 1, 2018
@domenkozar
Copy link
Member Author

value is %1% while a set was expected needs to always have Pos attached as per #3505

@stale
Copy link

stale bot commented Feb 15, 2021

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

@stale stale bot added the stale label Feb 15, 2021
@SuperSandro2000
Copy link
Member

bump

@stale stale bot removed the stale label Feb 17, 2021
@stale
Copy link

stale bot commented Aug 17, 2021

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

@stale stale bot added the stale label Aug 17, 2021
@fricklerhandwerk fricklerhandwerk added error-messages Confusing messages and better diagnostics language The Nix expression language; parser, interpreter, primops, evaluation, etc UX The way in which users interact with Nix. Higher level than UI. labels Sep 12, 2022
@roberth
Copy link
Member

roberth commented Jun 23, 2023

Still bad, at least in the repl

nix-repl> with (a: a); b   
error:
       … <borked>

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

       error: value is a function while a set was expected


It literally says <borked>

@stale stale bot removed the stale label Jun 23, 2023
@roberth roberth removed the UX The way in which users interact with Nix. Higher level than UI. label Jun 23, 2023
@thufschmitt thufschmitt added good first issue Quick win for first-time contributors idea approved The given proposal has been discussed and approved by the Nix team. An implementation is welcome. labels Jun 23, 2023
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/2023-06-22-nix-team-meeting-minutes-65/29643/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error-messages Confusing messages and better diagnostics good first issue Quick win for first-time contributors idea approved The given proposal has been discussed and approved by the Nix team. An implementation is welcome. language The Nix expression language; parser, interpreter, primops, evaluation, etc
Projects
None yet
Development

No branches or pull requests

8 participants