-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Nix flakes should not cache evaluation errors #3872
Comments
No, evaluation errors must be cached, because otherwise an operation like |
It also looks like evaluation errors in flake.nix files have no file name / line number. |
Evaluation error messages tend to be small. If no stack is included. |
They're pretty big, e.g.
|
How about an option that by-passes cached evaluation errors that is internally used by |
Normally that cache works just fine. Everytime I change something the cached failure is gone. The problem I have is, how do I remove the cached failure. Because when I play with the daemon I cache failures, where the fixed comes in a changed daemon and so no changes in the nix files. |
What if the error message was also cached? |
@kloenk Only |
I got my wopAddToStoreNar (I think it was) to fail. This made it impossible to include sources in the eval step |
Hm, that still shouldn't be cached because such an error is not a subclass of |
The daemon did not response with an error to addToStore, so the eval failed with no such file or directory |
Can we |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/flakes-with-unfree-licenses/9405/1 |
@Mic92 I might have just run into a variant of this:
Is this a regression or intended behavior somehow? |
Looks like this error is similar. |
This threw me off yesterday in my personal config. My workaround was just to change something and try rebuilding again to get around the cache. |
Here's another case |
I agree that we should cache the evaluation error, since it doesn't make sense to wait an hour for a long build if we can be certain it will fail. I'm suggesting though that nix should print the command to retrieve the build log This would make life so much easier. The workaround of changing a variable and then forcing a rebuild is stealing focus from the actual problem at hand - the failing build. It also doesn't always work as expected, depending on the project size you need to find a suitable variable/dependency. |
Instead of
I have just tested |
If a build fails with little information
then I want the trace but I can't
How can I get the trace in this case? |
You can disable the eval cache as a workaround: |
Thanks @ncfavier for the tip. I think this cache should probably be ignored when |
Also |
A possible fix to my issue above could be to also cache the error when the eval fails to be able to print it again. |
This is a better solution than my |
Error caching is enabled by default when using nixos-rebuild with a flake. This supresses error messages on subsequent retries of a bad NixOS config which makes viewing related logs challenging. Disabling the error cache ensures that the error messages will print every time a rebuild is attempted. See NixOS/nix#3872.
This issue has been mentioned on NixOS Discourse. There might be relevant details there: |
Still an issue. |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/the-option-programs-kitty-does-not-exist/39447/1 |
people already asked above, but hadn't seem to get an answer. can't error messages also be cached? is this not feasible because the error message might be too big? |
I don't think there's a strong reason for not doing that. Mostly needs someone to go and fix it |
btw for everyone reading here, I started working on that: #10368 (again). |
The amount of time i have seen this cached error message and not knowing what it actually is, is getting ridiculous. |
@dejanr Then please make an issue with a reproduction so we can fix it. |
@edolstra there's #10368 fixing the core issue (that by default eval errors are being cached) in the second commit. |
I am no longer able to reproduce the cached eval errors with nix 2.22.
|
I just witnessed this behavior on my system running nixos 24.05. |
@jottr check your nix version. This was fixed in 2.23 and I guess backported to 2.22. |
This needs better documentation. This is currently the best documentation I could find. Having to dig through a 4 year old issue is not great documentation. Very frustrating. |
If anything it needs backports, as the problem has been fixed in recent versions. PRs welcome. If not backported, the fix will be delivered anyway to NixOS in the upcoming release, 24.11. Updated documentation will be obsolete by the end of the year. |
EOY is still a few months away. Sufficient opportunity to trip people up
and taint their experience using nix
This is especially the case for people just picking up nix.
Which can be observed in this very issue.
It should be trivial to someone with sufficient understanding of the nix
ecosystem to update the documentation with a warning.
…On Sun, Sep 8, 2024, 02:04 Robert Hensing ***@***.***> wrote:
This needs better documentation.
If anything it needs backports, as the problem has been fixed in recent
versions. PRs welcome.
If not backported, the fix will be delivered anyway to NixOS in the
upcoming release, 24.11. Updated documentation will be obsolete by the end
of the year.
—
Reply to this email directly, view it on GitHub
<#3872 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAU57BX3HFOBMXDMZHRAIYDZVOH7BAVCNFSM4PKGQBT2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMZTGY2DQNRWGUZA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
created #11445 to backport to 2.18 |
Describe the bug
Currently error messages are only showed the first time they appear.
After that the error message looks like this:
The problem is that the error message of the first time might be no longer visible,
so users would get stuck not knowing what its going on.
Steps To Reproduce
nixos-rebuild switch
:nixos-rebuild switch
again:Expected behavior
It should not cache evaluation failures and show me the message agin
nix-env --version
outputThe text was updated successfully, but these errors were encountered: