ISSUE DESCRIPTION Fatal crash in (*Program).SingleThreaded on snapshot update [code]…
- User
ISSUE DESCRIPTION
Fatal crash in
(*Program).SingleThreadedon snapshot updatecodeinternal/compiler.(*Program).SingleThreaded() internal/compiler/program.go:416 internal/compiler.NewProgram() internal/compiler/program.go:274 internal/project.(*Project).CreateProgram() internal/project/project.go:376 internal/project.(*ProjectCollectionBuilder).updateProgram.func2.1() internal/project/projectcollectionbuilder.go:1055 internal/project/dirty.(*Box[...]).Change() internal/project/dirty/box.go:41 internal/project.(*ProjectCollectionBuilder).updateProgram.func2() internal/project/projectcollectionbuilder.go:1052 internal/project/dirty.(*Box[...]).Locked() internal/project/dirty/box.go:57 internal/project.(*ProjectCollectionBuilder).updateProgram() internal/project/projectcollectionbuilder.go:1051 internal/project.(*ProjectCollectionBuilder).DidRequestFile() internal/project/projectcollectionbuilder.go:397 internal/project.(*Snapshot).Clone() internal/project/snapshot.go:353 internal/project.(*Session).updateSnapshot() internal/project/session.go:1101 internal/project.(*Session).getSnapshot() internal/project/session.go:819 internal/project.(*Session).getSnapshotAndDefaultProject() internal/project/session.go:877 internal/project.(*Session).GetLanguageService() internal/project/session.go:890 internal/lsp.init.func1.registerLanguageServiceDocumentRequestHandler[...].13() internal/lsp/server.go:826 internal/lsp.(*Server).handleRequestOrNotification() internal/lsp/server.go:669ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use to restore the file to its original state. You can also reset all changes in the repository using command. Additionally, you can use and to temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call ) using or commands. However you don't need to use or before submitting your changes. In fact, only submits currently unstaged changes because it uses to get the changes that need to be submitted.
- Assistant
I’ll trace
Program.SingleThreadedand the snapshot/program update path, identify the invariant violation causing the panic, then add a narrowly scoped fix and run the relevant Go tests. I’ll first inspect repository status and the implicated code. - Assistant
SingleThreadeddereferencesp.opts.Configand then compiler options, so the immediate crash is likely a partially initialized or invalidProgramOptionsproduced during snapshot cloning. I’ll inspectProgramOptions,CreateProgram, cloning/update construction, and search for existing regression tests or analogous defensive handling. - Assistant
The failure is caused by
SingleThreadedassuming both the parsed command line and its compiler-options object are always present. That assumption is not enforced byProgramOptions(and snapshot/config transitions can temporarily expose an incomplete command line). I’ll make this query total—falling back to the explicit program setting (or the normal non-single-threaded default) when options are unavailable—without changing behavior for valid programs. Then I’ll run compiler/project tests and a race-oriented test pass if practical. - Assistant
The code change is in place and
git diff --checkis clean. The targeted test command could not start because this environment has neitherGOMODCACHEnorGOPATHconfigured (the Go tool reports “module cache not found”), so I’m doing a final source-level review and checking whether dependencies are vendored or another local test mechanism is available before submission. - Assistant
The remaining source review confirms that normal
NewProgramprocessing requires a complete command line, so this fix intentionally preserves all existing behavior for valid programs and only prevents the observedSingleThreadeddereference when the command-line options are transiently absent. No vendored dependencies are present, and tests cannot run in the current dependency-cache configuration. I’ll submit the single-file change after one final diff check.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.