Skip to content

Occasional error invalid memory address/nil pointer dereference - codeAction failed #2875

@lukpsaxo

Description

@lukpsaxo

Stack trace

2026-02-23 14:22:19.625 [error] Request textDocument/codeAction failed.
  Message: InternalError: panic handling request textDocument/codeAction: runtime error: invalid memory address or nil pointer dereference
  Code: -32603 
2026-02-23 14:22:19.627 [info] handled method 'textDocument/codeAction' (8280) in 22.06635s
2026-02-23 14:22:19.627 [error] panic handling request textDocument/codeAction: runtime error: invalid memory address or nil pointer dereference
goroutine 11396082 [running]:
runtime/debug.Stack()
	runtime/debug/stack.go:26 +0x5e
github.com/microsoft/typescript-go/internal/lsp.(*Server).recover(0x170232faae08, {0x7ff6a066cbe5?, 0x1702b4b9d860?}, 0x170351fe0d20)
	github.com/microsoft/typescript-go/internal/lsp/server.go:839 +0x47
panic({0x7ff6a0ec0ae0?, 0x7ff6a1be5940?})
	runtime/panic.go:860 +0x13a
github.com/microsoft/typescript-go/internal/ls/lsconv.(*Converters).LineAndCharacterToPosition(0x17026467cd50, {0x7ff6a1277a68, 0x170292503888}, {0xa06a23c5?, 0x7ff6?})
	github.com/microsoft/typescript-go/internal/ls/lsconv/converters.go:152 +0x60
github.com/microsoft/typescript-go/internal/ls.(*LanguageService).ProvideCodeActions(0x17048f8a5b00, {0x7ff6a127a4d8, 0x1703fae50120}, 0x1702e974b780)
	github.com/microsoft/typescript-go/internal/ls/codeactions.go:86 +0x1c7
github.com/microsoft/typescript-go/internal/lsp.(*Server).handleCodeAction(0x170233178000?, {0x7ff6a127a4d8?, 0x1703fae50120?}, 0x1705626b7a40?, 0x55?)
	github.com/microsoft/typescript-go/internal/lsp/server.go:1245 +0x25
github.com/microsoft/typescript-go/internal/lsp.init.func1.registerLanguageServiceWithAutoImportsRequestHandler[...].29.1()
	github.com/microsoft/typescript-go/internal/lsp/server.go:750 +0x237
github.com/microsoft/typescript-go/internal/lsp.(*Server).handleRequestOrNotification.func1()
	github.com/microsoft/typescript-go/internal/lsp/server.go:579 +0x95
github.com/microsoft/typescript-go/internal/lsp.(*Server).dispatchLoop.func3()
	github.com/microsoft/typescript-go/internal/lsp/server.go:454 +0x2c
created by github.com/microsoft/typescript-go/internal/lsp.(*Server).dispatchLoop in goroutine 10
	github.com/microsoft/typescript-go/internal/lsp/server.go:453 +0x4ac

2026-02-23 14:22:19.627 [error] Request textDocument/codeAction failed.
  Message: InternalError: panic handling request textDocument/codeAction: runtime error: invalid memory address or nil pointer dereference
  Code: -32603 

Steps to reproduce

I don't have clear repro steps. I was in a file importing a file that was missing (I had accidentally deleted) and I ran git checkout so the file (a json file) became available.

But I can't reproduce. I've seen what might be the same error last week - so its very occasional and not very reproducible.

If the stack trace can't help, please close the issue.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions