Versions: lsprotocol 2025.0.0, cattrs 26.1.0, attrs 26.1.0, Python 3.14.2
converter.structure(...) raises StructureHandlerNotFoundError when structuring a real InitializeResult whose capabilities.notebookDocumentSync.notebookSelector contains an entry with only cells (no notebook key) — i.e. the legal "cells-only" NotebookDocumentFilterWithCells shape. Captured verbatim from a real server (ty server, Astral's Python language server) but doesn't depend on it — reproduces with just lsprotocol + cattrs:
from lsprotocol import converters, types
conv = converters.get_converter()
raw = {
"jsonrpc": "2.0",
"id": 1,
"result": {
"capabilities": {
"notebookDocumentSync": {
"notebookSelector": [{"cells": [{"language": "python"}]}]
}
}
},
}
conv.structure(raw, types.InitializeResponse)
Traceback (innermost frame):
cattrs.errors.StructureHandlerNotFoundError: Unsupported type: str | lsprotocol.types.NotebookDocumentFilterNotebookType | lsprotocol.types.NotebookDocumentFilterScheme | lsprotocol.types.NotebookDocumentFilterPattern | None. Register a structure hook for it.
Structuring typing.Sequence[lsprotocol.types.NotebookDocumentFilterWithNotebook | lsprotocol.types.NotebookDocumentFilterWithCells] @ index 0
cattrs can't find/build a structure hook for NotebookDocumentFilterWithCells.notebook's declared union type even though the input omits that key entirely (so the field should just take its default). Every InitializeResponse a server advertises notebookDocumentSync capabilities in — regardless of whether the client cares about notebooks at all — currently fails to structure.
Versions: lsprotocol 2025.0.0, cattrs 26.1.0, attrs 26.1.0, Python 3.14.2
converter.structure(...)raisesStructureHandlerNotFoundErrorwhen structuring a realInitializeResultwhosecapabilities.notebookDocumentSync.notebookSelectorcontains an entry with onlycells(nonotebookkey) — i.e. the legal "cells-only"NotebookDocumentFilterWithCellsshape. Captured verbatim from a real server (ty server, Astral's Python language server) but doesn't depend on it — reproduces with just lsprotocol + cattrs:Traceback (innermost frame):
cattrs can't find/build a structure hook for
NotebookDocumentFilterWithCells.notebook's declared union type even though the input omits that key entirely (so the field should just take its default). EveryInitializeResponsea server advertisesnotebookDocumentSynccapabilities in — regardless of whether the client cares about notebooks at all — currently fails to structure.