Skip to content

Crashes in VS Code due to Pydantic Validation Error #963

@sohang3112

Description

@sohang3112

Python Language Server keeps crashing in VS Code due to a Pydantic Validation Error. See the full error trackeback output below:

Traceback (most recent call last):
  File "c:\Users\SohangChopra\.vscode\extensions\ms-python.python-2023.2.0\pythonFiles\lib\jedilsp\pygls\protocol.py", line 152, in deserialize_message
    deserialize_params(data, get_params_type)
  File "c:\Users\SohangChopra\.vscode\extensions\ms-python.python-2023.2.0\pythonFiles\lib\jedilsp\pygls\protocol.py", line 138, in deserialize_params
    data['params'] = params_type(**params)
  File "c:\Users\SohangChopra\.vscode\extensions\ms-python.python-2023.2.0\pythonFiles\lib\jedilsp\pygls\lsp\types\basic_structures.py", line 58, in __init__
    super().__init__(**data)
  File "c:\Users\SohangChopra\.vscode\extensions\ms-python.python-2023.2.0\pythonFiles\lib\jedilsp\pydantic\main.py", line 342, in __init__
    raise validation_error
pydantic.error_wrappers.ValidationError: 6 validation errors for CodeActionParams
context -> diagnostics -> 0 -> range -> start -> line
  none is not an allowed value (type=type_error.none.not_allowed)
context -> diagnostics -> 0 -> range -> end -> line
  none is not an allowed value (type=type_error.none.not_allowed)
context -> diagnostics -> 1 -> range -> start -> line
  none is not an allowed value (type=type_error.none.not_allowed)
context -> diagnostics -> 1 -> range -> end -> line
  none is not an allowed value (type=type_error.none.not_allowed)
context -> diagnostics -> 2 -> range -> start -> line
  none is not an allowed value (type=type_error.none.not_allowed)
context -> diagnostics -> 2 -> range -> end -> line
  none is not an allowed value (type=type_error.none.not_allowed)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\Users\SohangChopra\.vscode\extensions\ms-python.python-2023.2.0\pythonFiles\run-jedi-language-server.py", line 11, in <module>
    sys.exit(cli())
  File "c:\Users\SohangChopra\.vscode\extensions\ms-python.python-2023.2.0\pythonFiles\lib\jedilsp\jedi_language_server\cli.py", line 125, in cli
    SERVER.start_io()
  File "c:\Users\SohangChopra\.vscode\extensions\ms-python.python-2023.2.0\pythonFiles\lib\jedilsp\pygls\server.py", line 225, in start_io
    self.loop.run_until_complete(
  File "C:\Users\SohangChopra\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 641, in run_until_complete
    return future.result()
  File "c:\Users\SohangChopra\.vscode\extensions\ms-python.python-2023.2.0\pythonFiles\lib\jedilsp\pygls\server.py", line 78, in aio_readline
    proxy(b''.join(message))
  File "c:\Users\SohangChopra\.vscode\extensions\ms-python.python-2023.2.0\pythonFiles\lib\jedilsp\pygls\protocol.py", line 456, in data_received
    json.loads(body.decode(self.CHARSET),
  File "C:\Users\SohangChopra\AppData\Local\Programs\Python\Python310\lib\json\__init__.py", line 359, in loads
    return cls(**kw).decode(s)
  File "C:\Users\SohangChopra\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\SohangChopra\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
  File "c:\Users\SohangChopra\.vscode\extensions\ms-python.python-2023.2.0\pythonFiles\lib\jedilsp\pygls\protocol.py", line 154, in deserialize_message
    raise JsonRpcInvalidParams()
pygls.exceptions.JsonRpcInvalidParams: Invalid Params
[Info  - 6:16:31 PM] Connection to server got closed. Server will restart.
WARNING:pygls.protocol:Cancel notification for unknown message id "2"
WARNING:pygls.protocol:Cancel notification for unknown message id "15"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions