No such file or directory in flakes is a terrible error message #175

Open
opened 2024-03-25 05:02:59 +00:00 by jade · 7 comments
Owner

Steps to reproduce:

  1. Create somefile.nix and forget to add it to git.
  2. import ./somefile.nix in flake.nix
  3. Get a confusing error message.

At the very least, for now we should consider catching that particular error and printing a hint that it might be that, for flakes, even without checking the original directory for if the file is there.

This error can be more properly diagnosed after pennae finishes the future big evaluator IO refactor.

See also @qyriad 's PR: https://github.com/NixOS/nix/pull/9398

Steps to reproduce: 1. Create somefile.nix and forget to add it to git. 2. `import ./somefile.nix` in flake.nix 3. Get a confusing error message. At the very least, *for now* we should consider catching that particular error and printing a hint that it might be that, for flakes, even without checking the original directory for if the file is there. This error can be more properly diagnosed after pennae finishes the future big evaluator IO refactor. See also @qyriad 's PR: https://github.com/NixOS/nix/pull/9398
jade added the
ux
E/easy
E/help wanted
labels 2024-03-25 05:03:00 +00:00
Owner

We have a branch somewhere that adds the filepaths involved in IO errors to the relevant exception classes and uses it in the error message.

@rbt 's structured errors PR would probably be a better foundation though

We have a branch somewhere that adds the filepaths involved in IO errors to the relevant exception classes and uses it in the error message. @rbt 's structured errors PR would probably be a better foundation though
Owner
Found our branch: [https://github.com/Qyriad/nix/compare/19993398a12069a868b0fb10b63f7d06f0f993e6...Qyriad:nix:cdc1a66e31c499506f6de4c7d8718ff09b105655](https://github.com/Qyriad/nix/compare/19993398a12069a868b0fb10b63f7d06f0f993e6...Qyriad:nix:cdc1a66e31c499506f6de4c7d8718ff09b105655)
Member

Is there any reason we don't want to check the original directory to see if the file was there?

Is there any reason we don't want to check the original directory to see if the file was there?
Owner
Our branch does this: https://github.com/Qyriad/nix/blob/cdc1a66e31c499506f6de4c7d8718ff09b105655/src/libexpr/flake/flake.cc#L224
Author
Owner

Is there any reason we don't want to check the original directory to see if the file was there?

Mainly for potential lack of having the information. If we have the information, absolutely do it though.

> Is there any reason we don't want to check the original directory to see if the file was there? Mainly for potential lack of *having* the information. If we have the information, absolutely do it though.
Member

When the original source dir is available, this could even go one step further and throw a warning when builtins.readDir is called, but not all directory entries are present in the store, for example forgetting to add a pkgs/by-name.

When the original source dir is available, this could even go one step further and throw a warning when builtins.readDir is called, but not all directory entries are present in the store, for example forgetting to add a pkgs/by-name.
jade added the
Area/flakes
label 2024-03-30 00:04:22 +00:00
jade was assigned by qyriad 2024-05-13 00:36:54 +00:00
qyriad added this to the v2.91 milestone 2024-05-13 00:37:00 +00:00
qyriad self-assigned this 2024-05-13 00:37:07 +00:00
jade was unassigned by qyriad 2024-05-13 00:37:15 +00:00
Owner

We have a WIP CL for this: https://gerrit.lix.systems/c/lix/+/970, but it will not be until 2.91

We have a WIP CL for this: https://gerrit.lix.systems/c/lix/+/970, but it will not be until 2.91
jade modified the milestone from v2.91 to post-release 2024-08-13 01:19:36 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#175
No description provided.