REPL overlays prevent debugger from opening for stack overflows #1220

Open
opened 2026-05-29 10:20:00 +00:00 by blokyk · 1 comment
Member

Describe the bug

When trying to debug an expression that causes a stack overflow (as foolish as that might be), the debugger will try to load any REPL overlays, causing a further stack-overflow error, preventing the debugger from actually opening. It also often produces very confusing error traces sometimes (having the displayed error in the repl overlay instead of in the file), but I can't minimalise the case where I'm seeing that :/

Steps To Reproduce

$ nix eval -E 'let f = x: f (x + 1); in f 0' --debugger --impure
Lix 2.95.3
Type :? for help.
error: stack overflow; max-call-depth exceeded
       at «string»:1:12:
            1| let f = x: f (x + 1); in f 0
             |            ^

Added 2 variables.
Loading 'repl-overlays'...
error: stack overflow; max-call-depth exceeded

Expected behavior

Either REPL overlays actually get loaded (unlikely), or they just get disabled with a warning.

nix --version output

nix (Lix, like Nix) 2.95.3
System type: x86_64-linux
Additional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux
Features: gc, signed-caches
System configuration file: /etc/nix/nix.conf
User configuration files: /home/courvoie/.config/nix/nix.conf:/etc/xdg/xdg-ubuntu-xorg/nix/nix.conf:/etc/xdg/nix/nix.conf
Store directory: /nix/store
State directory: /nix/var/nix
Data directory: /nix/store/11mvswxaqf962apqki9i0b8b56qj9irr-lix-2.95.3/share

Note that this also happens on main.

Additional context

  1. Sorry for finding so many obscure bugs, I swear I don't do it on purpose :(
  2. There have been discussions (both in issues but also in DMs) of just disabling repl-overlays in general for the debugger to ensure they don't interfere with the evaluator state. That doesn't mean this issue can be temporarily fixed now with a more general fix/disable later.
## Describe the bug When trying to debug an expression that causes a stack overflow (as foolish as that might be), the debugger will try to load any REPL overlays, causing a further stack-overflow error, preventing the debugger from actually opening. It also often produces very confusing error traces sometimes (having the displayed error in the repl overlay instead of in the file), but I can't minimalise the case where I'm seeing that :/ ## Steps To Reproduce ```sh $ nix eval -E 'let f = x: f (x + 1); in f 0' --debugger --impure Lix 2.95.3 Type :? for help. error: stack overflow; max-call-depth exceeded at «string»:1:12: 1| let f = x: f (x + 1); in f 0 | ^ Added 2 variables. Loading 'repl-overlays'... error: stack overflow; max-call-depth exceeded ``` ## Expected behavior Either REPL overlays actually get loaded (unlikely), or they just get disabled with a warning. ## `nix --version` output ``` nix (Lix, like Nix) 2.95.3 System type: x86_64-linux Additional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux Features: gc, signed-caches System configuration file: /etc/nix/nix.conf User configuration files: /home/courvoie/.config/nix/nix.conf:/etc/xdg/xdg-ubuntu-xorg/nix/nix.conf:/etc/xdg/nix/nix.conf Store directory: /nix/store State directory: /nix/var/nix Data directory: /nix/store/11mvswxaqf962apqki9i0b8b56qj9irr-lix-2.95.3/share ``` Note that this also happens on main. ## Additional context 1. Sorry for finding so many obscure bugs, I swear I don't do it on purpose :( 2. There have been discussions (both [in issues](https://git.lix.systems/lix-project/lix/issues/1212#issuecomment-18799) but also in DMs) of just disabling repl-overlays in general for the debugger to ensure they don't interfere with the evaluator state. That doesn't mean _this_ issue can be temporarily fixed now with a more general fix/disable later.
Owner

we really should disable overlays when launching as a debugger, yes. that would be a really easy fix too; we already have the debugger-ness state when launching the repl and could just also use that to not load overlays (perhaps with a message that we're doing this to avoid confusing people?)

we really should disable overlays when launching as a debugger, yes. that would be a really easy fix too; we already have the debugger-ness state when launching the repl and could just also use that to not load overlays (perhaps with a message that we're doing this to avoid confusing people?)
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#1220
No description provided.