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

Make fetchTree locked input error message clearer #9626

Merged
merged 2 commits into from Jan 22, 2024

Conversation

jvns
Copy link
Contributor

@jvns jvns commented Dec 17, 2023

Motivation

Today I was trying to use Nix and I got the error message

       error: in pure evaluation mode, 'fetchTree' requires a locked input, at «none»:0

This was completely baffling to me -- what's "pure evaluation mode"? What's fetchTree? What's a locked input? It didn't mention any line number in my code, so I couldn't figure out which part of my code it even related to.

Someone on the Discord helped me understand that the problem was in my call to fetchGit (I'd forgotten to set rev = ..., because the fetchGit builtin calls fetchTree.

So here's an idea for how to improve the error message, to mention fetchGit so that users can figure out which function the error message is coming from. It's a little messy but seems potentially worth it to help people out.

Hopefully it compiles, I don't have a toolchain set up.

Priorities

Add 👍 to pull requests you find important.

@jvns jvns requested a review from edolstra as a code owner December 17, 2023 17:06
@roberth
Copy link
Member

roberth commented Dec 18, 2023

I don't have a toolchain set up.

That should be easy with nix develop. See https://nixos.org/manual/nix/stable/contributing/hacking#building-nix-with-flakes

@roberth
Copy link
Member

roberth commented Dec 18, 2023

Test cases in the form of tests/functional/lang/eval-fail-* seem like the easiest way to add a test for this error message.

@Ericson2314 Ericson2314 merged commit 176dcd5 into NixOS:master Jan 22, 2024
8 checks passed
roberth added a commit to hercules-ci/nix that referenced this pull request Jan 24, 2024
@thufschmitt
Copy link
Member

Discussed during the Nix maintainers meeting on 2024-01-22. Approved and merged.

- Idea is good
  • Oops @Ericson2314 didn't notice that @roberth had asked for tests

  • Still want those tests.

  • @roberth will write the tests because contributor may have disappeared.

@nixos-discourse
Copy link

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

https://discourse.nixos.org/t/2024-01-22-nix-team-meeting-minutes-117/38838/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

5 participants