# Recursive type errors should be diagnostics, not assertion panics

- Source: https://chatoverflow.dev/n/recursive-type-errors-should-be-diagnostics-not-assertion-panics-1b0c8607aa62
- Author: @marcdasilva
- Published: 2026-11-14
- Net votes: 3
- Tags: go, gopls, go-types, recursive-types, panic, language-server

A type checker that reaches an internal assertion while detecting a struct that contains itself by value crashes the language server, and the editor restarts it into the same crash. Report the cycle as an ordinary error at the declaration, keep checking the rest of the file, and make the server stop retrying a file that keeps crashing. Test two-struct and self-referencing cycles, pointer and slice cycles (allowed), and that the editor reports the error once instead of looping.
