Feature Request: Compact Traces (without code snippets) #960

Open
opened 2025-08-15 13:59:47 +00:00 by sterni · 2 comments

I find the “new” error traces frustrating to use since they take up much too much space since they print code locations. Since the error and the location that causes it are typically far apart in Nix code, it is preferable to see as much of the trace as possible over seeing a bunch of code snippets that are more often than not irrelevant. The files and line numbers plus added context (function names, primop names, derivation names) usually give enough information (and can be supplemented by Plan 9 style editor tooling that quickly allows you to jump to the locations). When debugging infinite recursions I think the verbose traces are even more problematic since you frequently have to simultaneously look at completely disparate parts of the trace which means a lot of scrolling around currently.

I think this problem has in principle (been recognized](5cb98095ba).

Describe the solution you'd like

A config option that makes the output with --show-trace less verbose by hiding the code snippets. Ideally each trace entry would be one line again like in C++ Nix < 2.4.

Describe alternatives you've considered

Patching Lix. Just showing the last location in the trace. Another flag or environment variable.

## Is your feature request related to a problem? Please describe. I find the “new” error traces frustrating to use since they take up much too much space since they print code locations. Since the error and the location that causes it are typically far apart in Nix code, it is preferable to see as much of the trace as possible over seeing a bunch of code snippets that are more often than not irrelevant. The files and line numbers plus added context (function names, primop names, derivation names) usually give enough information (and can be supplemented by Plan 9 style editor tooling that quickly allows you to jump to the locations). When debugging infinite recursions I think the verbose traces are even more problematic since you frequently have to simultaneously look at completely disparate parts of the trace which means a lot of scrolling around currently. I think this problem has in principle (been recognized](https://github.com/nixos/nix/commit/5cb98095ba2c3de83d32c1729da7b9f6cfb1aeff). ## Describe the solution you'd like A config option that makes the output with `--show-trace` less verbose by hiding the code snippets. Ideally each trace entry would be one line again like in C++ Nix < 2.4. ## Describe alternatives you've considered Patching Lix. Just showing the last location in the trace. Another flag or environment variable.
Author

I'd be happy to implement this myself, but would like to get confirmation that such a change would be accepted.

I'd be happy to implement this myself, but would like to get confirmation that such a change would be accepted.
Owner

sure, send a cl. other people may want it the other way around even, with more context per frame. making the context size configurable sounds pretty straight-forward

sure, send a cl. other people may want it the other way around even, with *more* context per frame. making the context size configurable sounds pretty straight-forward
Sign in to join this conversation.
No milestone
No project
No assignees
2 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#960
No description provided.