go to definition panic (windows, wsl)
Stack trace
[ERROR][2025-10-15 21:08:49] ...p/_transport.lua:36 "rpc" "tsgo" "stderr" "panic: runtime error: invalid memory address or nil pointer dereference [recovered, repanicked]
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0xa0ce16]
goroutine 258 [running]:
github.com/microsoft/typescript-go/internal/project.(*Snapshot).Clone.func1()
github.com/microsoft/typescript-go/internal/project/snapshot.go:154 +0x7d
panic({0xb40dc0?, 0x1489090?})
runtime/panic.go:783 +0x132
sync/atomic.(*Int32).Add(...)
sync/atomic/type.go:94
sync.(*RWMutex).RLock(...)
sync/rwmutex.go:72
github.com/microsoft/typescript-go/internal/project.(*WatchedFiles[...]).Clone(0xc0035a83c0, {{0xc004555110?, 0xc000181798?, 0xc00015b100?}, 0x0?})
github.com/microsoft/typescript-go/internal/project/watch.go:121 +0x56
github.com/microsoft/typescript-go/internal/project.(*projectCollectionBuilder).DidUpdateATAState.(*projectCollectionBuilder).DidUpdateATAState.func1.func3(0xc0035a4620)
github.com/microsoft/typescript-go/internal/project/projectcollectionbuilder.go:353 +0x11b
github.com/microsoft/typescript-go/internal/project/dirty.(*Box[...]).Change(0xc000332000?, 0xc000181870?)
github.com/microsoft/typescript-go/internal/project/dirty/box.go:41 +0x6b
github.com/microsoft/typescript-go/internal/project/dirty.(*Box[...]).ChangeIf(0xea7fa0, 0xc0001818b8, 0xc000181870?)
github.com/microsoft/typescript-go/internal/project/dirty/box.go:46 +0x45
github.com/microsoft/typescript-go/internal/project.(*projectCollectionBuilder).DidUpdateATAState.func1(...)
github.com/microsoft/typescript-go/internal/project/projectcollectionbuilder.go:331
github.com/microsoft/typescript-go/internal/project.(*projectCollectionBuilder).DidUpdateATAState(0xc003572380, 0xd282d8?, 0xc003570e10)
github.com/microsoft/typescript-go/internal/project/projectcollectionbuilder.go:363 +0x1b2
github.com/microsoft/typescript-go/internal/project.(*Snapshot).Clone(0xc000227570, {0xe9d0f0, 0xc003570d70}, {0x3, {{0x0, 0x0}, 0x0, {0x0}, {0x0}, {0x0}}, ...}, ...)
github.com/microsoft/typescript-go/internal/project/snapshot.go:205 +0x67d
github.com/microsoft/typescript-go/internal/project.(*Session).UpdateSnapshot(0xc00036c000, {0xe9d0f0, 0xc003570d70}, 0xc00012e540, {0x3, {{0x0, 0x0}, 0x0, {0x0}, {0x0}, ...}, ...})
github.com/microsoft/typescript-go/internal/project/session.go:382 +0xb3
github.com/microsoft/typescript-go/internal/project.(*Session).GetLanguageService(0xc00036c000, {0xe9d0f0, 0xc003570d70}, {0xc00088c000, 0x99})
github.com/microsoft/typescript-go/internal/project/session.go:349 +0x338
github.com/microsoft/typescript-go/internal/lsp.init.func1.registerLanguageServiceDocumentRequestHandler[...].13({0xe9d0f0, 0xc003570d70}, 0xc0022e80f0"
Steps to reproduce
- go to definition twice (generally the first time it works, then no more)
I'm pretty sure this is happening for almost every operation for me. completions, go to def, whatever - it'll cause this panic.
I have @latest and im using nvim, but i've always experienced this on windows and only got around to opening an issue now.
have been experiencing this issue on MacOs as well recently.
github.com/microsoft/typescript-go/internal/execute/incremental.buildInfoToSnapshot(0x14000000140, 0x140001867e0, {0x1012cfc70, 0x140000bf860})
github.com/microsoft/typescript-go/internal/execute/incremental/buildinfotosnapshot.go:34 +0x340
github.com/microsoft/typescript-go/internal/execute/incremental.ReadBuildInfoProgram(0x140001867e0, {0x1012ca4a0?, 0x14000034020?}, {0x1012cfc70, 0x140000bf860})
github.com/microsoft/typescript-go/internal/execute/incremental/incremental.go:53 +0x90
github.com/microsoft/typescript-go/internal/execute.performIncrementalCompilation({0x1012d1a78, 0x140000787e0}, 0x140001867e0, 0x1400030a040, 0x1400030a060, {0x1012ca460, 0x1400010d890}, 0x1400002b640, {0x0, 0x0})
github.com/microsoft/typescript-go/internal/execute/tsc.go:250 +0x200
github.com/microsoft/typescript-go/internal/execute.tscCompilation({0x1012d1a78, 0x140000787e0}, 0x14000186c60, {0x0, 0x0})
github.com/microsoft/typescript-go/internal/execute/tsc.go:200 +0x8d8
github.com/microsoft/typescript-go/internal/execute.CommandLine({0x1012d1a78, 0x140000787e0}, {0x1400001e0d0, 0x1, 0x1}, {0x0, 0x0})
github.com/microsoft/typescript-go/internal/execute/tsc.go:34 +0x18c
main.runMain()
github.com/microsoft/typescript-go/cmd/tsgo/main.go:23 +0x120
main.main()
github.com/microsoft/typescript-go/cmd/tsgo/main.go:10 +0x1c
We could realize use a concrete repro for this. Do you have steps that reliably cause it?
@RyanCavanaugh im really struggling to come up with a repro since it happens constantly for me on WSL with latest
im using neovim and neovim-lspconfig.
if i open a .ts file and do nothing, the server will crash after a second or two with this:
[ERROR][2025-11-23 09:52:11] ...p/_transport.lua:36 "rpc" "tsgo" "stderr" "panic: runtime error: invalid memory address or nil pointer dereference [recovered, repanicked]\n[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0xa80c16]\n\ngoroutine 923 [running]:\ngithub.com/microsoft/typescript-go/internal/project.(*Snapshot).Clone.func1()\n\tgithub.com/microsoft/typescript-go/internal/project/snapshot.go:201 +0x7d\n"
[ERROR][2025-11-23 09:52:11] ...p/_transport.lua:36 "rpc" "tsgo" "stderr" "panic({0xbc7160?, 0x169ab20?})\n\truntime/panic.go:783 +0x132\nsync/atomic.(*Int32).Add(...)\n\tsync/atomic/type.go:94\nsync.(*RWMutex).RLock(...)\n\tsync/rwmutex.go:72\ngithub.com/microsoft/typescript-go/internal/project.(*WatchedFiles[...]).Clone(0xc0046362c0, {{0xc002099770?, 0xc000453590?, 0xc0000e3100?}, 0x0?})\n\tgithub.com/microsoft/typescript-go/internal/project/watch.go:121 +0x56\ngithub.com/microsoft/typescript-go/internal/project.(*ProjectCollectionBuilder).DidUpdateATAState.(*ProjectCollectionBuilder).DidUpdateATAState.func1.func3(0xc0040130a0)\n\tgithub.com/microsoft/typescript-go/internal/project/projectcollectionbuilder.go:521 +0x11b\ngithub.com/microsoft/typescript-go/internal/project/dirty.(*Box[...]).Change(0xc003ec8ed0?, 0xc000453668?)\n\tgithub.com/microsoft/typescript-go/internal/project/dirty/box.go:41 +0x6b\ngithub.com/microsoft/typescript-go/internal/project/dirty.(*Box[...]).ChangeIf(0x106a0e0, 0xc0004536b0, 0xc000453668?)\n\tgithub.com/microsoft/typescript-go/internal/project/dirty/box.go"
[ERROR][2025-11-23 09:52:11] ...p/_transport.lua:36 "rpc" "tsgo" "stderr" ":46 +0x45\ngithub.com/microsoft/typescript-go/internal/project.(*ProjectCollectionBuilder).DidUpdateATAState.func1(...)\n\tgithub.com/microsoft/typescript-go/internal/project/projectcollectionbuilder.go:499\ngithub.com/microsoft/typescript-go/internal/project.(*ProjectCollectionBuilder).DidUpdateATAState(0xc004020400, 0xdc5a28?, 0xc00400a7d0)\n\tgithub.com/microsoft/typescript-go/internal/project/projectcollectionbuilder.go:531 +0x1b2\ngithub.com/microsoft/typescript-go/internal/project.(*Snapshot).Clone(0xc00423a180, {0x105ed28, 0xc003c80d50}, {{{0xc002099330, 0x1, 0x1}, {0x0, 0x0, 0x0}, 0x0}, ...}, ...)\n\tgithub.com/microsoft/typescript-go/internal/project/snapshot.go:283 +0x9a5\ngithub.com/microsoft/typescript-go/internal/project.(*Session).UpdateSnapshot(0xc000324b40, {0x105ed28, 0xc003c80d50}, 0xc000378840, {{{0xc002099330, 0x1, 0x1}, {0x0, 0x0, 0x0}, "
[ERROR][2025-11-23 09:52:11] ...p/_transport.lua:36 "rpc" "tsgo" "stderr" "...}, ...})\n\tgithub.com/microsoft/typescript-go/internal/project/session.go:513 +0xb3\ngithub.com/microsoft/typescript-go/internal/project.(*Session).getSnapshot(0xc000324b40, {0x105ed28, 0xc003c80d50}, {{0xc002099330, 0x1, 0x1}, {0x0, 0x0, 0x0}, 0x0})\n\tgithub.com/microsoft/typescript-go/internal/project/session.go:391 +0x37a\ngithub.com/microsoft/typescript-go/internal/project.(*Session).getSnapshotAndDefaultProject(0xc000324b40, {0x105ed28, 0xc003c80d50}, {0xc004090060, 0x2e})\n\tgithub.com/microsoft/typescript-go/internal/project/session.go:441 +0x10b\ngithub.com/microsoft/typescript-go/internal/project.(*Session).GetLanguageService(0x4776c5?, {0x105ed28?, 0xc003c80d50?}, {0xc004090060?, 0xc003e4c000?})\n\tgithub.com/microsoft/typescript-go/internal/project/session.go:453 +0x25\n"
[ERROR][2025-11-23 09:52:11] ...p/_transport.lua:36 "rpc" "tsgo" "stderr" "github.com/microsoft/typescript-go/internal/lsp.init.func1.registerLanguageServiceDocumentRequestHandler[...].18({0x105ed28, 0xc003c80d50}, 0xc003cce360)\n\tgithub.com/microsoft/typescript-go/internal/lsp/server.go:582 +0xb6\ngithub.com/microsoft/typescript-go/internal/lsp.(*Server).handleRequestOrNotification(0xc0001e0008, {0x105ed60?, 0xc00400a730?}, 0xc003cce360)\n\tgithub.com/microsoft/typescript-go/internal/lsp/server.go:478 +0x153\ngithub.com/microsoft/typescript-go/internal/lsp.(*Server).dispatchLoop.func1()\n\tgithub.com/microsoft/typescript-go/internal/lsp/server.go:381 +0x3a\ncreated by github.com/microsoft/typescript-go/internal/lsp.(*Server).dispatchLoop in goroutine 34\n\tgithub.com/microsoft/typescript-go/internal/lsp/server.go:401 +0x9ad\n"
if you have any suggestion for how to narrow this down im all ears
but i can barely edit a typescript file right now without a crash
EDIT:
ok interesting, if i edit simple files which only use @types/node and local types, it seems somewhat stable.
if i edit a tsdown.config.ts (which imports tsdown), it crashes
i have seen this with many files, not only tsdown, but maybe this gives us more to go off
EDIT 2:
if i open the published DTS from tsdown and nothing else, it crashes.
if i empty that file entirely and just leave an export {};, it still crashes.
which suggests its nothing to do with the contents of the file, but the directory its in?