source_window was defined around line 880 but referenced in the before.event_stopped listener inside ensure_dapui (around line 730). Lua closures only capture upvalues that existed as locals BEFORE the closure was created — source_window fell back to a global lookup which resolved to nil, breaking every attempt to start a debug session. Forward-declare `local source_window` at the top of the file and assign (rather than declare) the implementation later. Both ensure_dapui's listener and the later call sites now refer to the same upvalue. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>