swyddfa / esbonio

A language server for working with Sphinx projects.
https://docs.esbon.io/
122 stars 21 forks source link

Sphinx agent not sending `dbpath` #732

Open alcarney opened 4 months ago

alcarney commented 4 months ago

As reported in https://github.com/swyddfa/esbonio/issues/440#issuecomment-1947339427

Python 3.12, sphinx 7.2.6, esbonio 0.92.1

[client] Starting Language Server
[esbonio] Initialising esbonio v1.0.0b1
[esbonio] Language client: Visual Studio Code 1.86.2
Running Sphinx v7.2.6
Unable to deserialize message
  + Exception Group Traceback (most recent call last):
  |   File "/Users/xxxxxx/.vscode/extensions/swyddfa.esbonio-0.92.1/bundled/libs/pygls/protocol/json_rpc.py", line 335, in _deserialize_message
  |     return self._converter.structure(data, response_type)
  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |   File "/Users/xxxxxx/.vscode/extensions/swyddfa.esbonio-0.92.1/bundled/libs/cattrs/converters.py", line 332, in structure
  |     return self._structure_func.dispatch(cl)(obj, cl)
  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |   File "<cattrs generated structure esbonio.sphinx_agent.types.CreateApplicationResponse>", line 20, in structure_CreateApplicationResponse
  |     if errors: raise __c_cve('While structuring ' + 'CreateApplicationResponse', errors, __cl)
  |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  | cattrs.errors.ClassValidationError: While structuring CreateApplicationResponse (1 sub-exception)
  +-+---------------- 1 ----------------
    | Exception Group Traceback (most recent call last):
    |   File "<cattrs generated structure esbonio.sphinx_agent.types.CreateApplicationResponse>", line 10, in structure_CreateApplicationResponse
    |     res['result'] = __c_structure_result(o['result'], __c_type_result)
    |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "<cattrs generated structure esbonio.sphinx_agent.types.SphinxInfo>", line 39, in structure_SphinxInfo
    |     if errors: raise __c_cve('While structuring ' + 'SphinxInfo', errors, __cl)
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | cattrs.errors.ClassValidationError: While structuring SphinxInfo (1 sub-exception)
    | Structuring class CreateApplicationResponse @ attribute result
    +-+---------------- 1 ----------------
      | Traceback (most recent call last):
      |   File "<cattrs generated structure esbonio.sphinx_agent.types.SphinxInfo>", line 35, in structure_SphinxInfo
      |     res['dbpath'] = __c_structure_dbpath(o['dbpath'])
      |                                           ~^^^^^^^^^^
      | KeyError: 'dbpath'
      | Structuring class SphinxInfo @ attribute dbpath
      +------------------------------------
lextm commented 4 months ago

I'd like to report something interesting. While preparing #735 I notice that when Python 3.12 is used for virtual environment, esbonio works flawlessly. A similar error occurs as soon as switching to Python 3.8.

The log entries from Python 3.8 is,

Running Sphinx v5.3.0
loading pickled environment...
done
Unable to deserialize message
  + Exception Group Traceback (most recent call last):
  |   File "/Users/lextm/.vscode/extensions/swyddfa.esbonio-0.92.1/bundled/libs/pygls/protocol/json_rpc.py", line 335, in _deserialize_message
  |     return self._converter.structure(data, response_type)
  |   File "/Users/lextm/.vscode/extensions/swyddfa.esbonio-0.92.1/bundled/libs/cattrs/converters.py", line 332, in structure
  |     return self._structure_func.dispatch(cl)(obj, cl)
  |   File "<cattrs generated structure esbonio.sphinx_agent.types.CreateApplicationResponse>", line 20, in structure_CreateApplicationResponse
  |     if errors: raise __c_cve('While structuring ' + 'CreateApplicationResponse', errors, __cl)
  | cattrs.errors.ClassValidationError: While structuring CreateApplicationResponse (1 sub-exception)
  +-+---------------- 1 ----------------
    | Exception Group Traceback (most recent call last):
    |   File "<cattrs generated structure esbonio.sphinx_agent.types.CreateApplicationResponse>", line 10, in structure_CreateApplicationResponse
    |     res['result'] = __c_structure_result(o['result'], __c_type_result)
    |   File "<cattrs generated structure esbonio.sphinx_agent.types.SphinxInfo>", line 39, in structure_SphinxInfo
    |     if errors: raise __c_cve('While structuring ' + 'SphinxInfo', errors, __cl)
    | cattrs.errors.ClassValidationError: While structuring SphinxInfo (1 sub-exception)
    | Structuring class CreateApplicationResponse @ attribute result
    +-+---------------- 1 ----------------
      | Traceback (most recent call last):
      |   File "<cattrs generated structure esbonio.sphinx_agent.types.SphinxInfo>", line 35, in structure_SphinxInfo
      |     res['dbpath'] = __c_structure_dbpath(o['dbpath'])
      | KeyError: 'dbpath'
      | Structuring class SphinxInfo @ attribute dbpath
      +------------------------------------

Error receiving data
  + Exception Group Traceback (most recent call last):
  |   File "/Users/lextm/.vscode/extensions/swyddfa.esbonio-0.92.1/bundled/libs/pygls/protocol/json_rpc.py", line 335, in _deserialize_message
  |     return self._converter.structure(data, response_type)
  |   File "/Users/lextm/.vscode/extensions/swyddfa.esbonio-0.92.1/bundled/libs/cattrs/converters.py", line 332, in structure
  |     return self._structure_func.dispatch(cl)(obj, cl)
  |   File "<cattrs generated structure esbonio.sphinx_agent.types.CreateApplicationResponse>", line 20, in structure_CreateApplicationResponse
  |     if errors: raise __c_cve('While structuring ' + 'CreateApplicationResponse', errors, __cl)
  | cattrs.errors.ClassValidationError: While structuring CreateApplicationResponse (1 sub-exception)
  +-+---------------- 1 ----------------
    | Exception Group Traceback (most recent call last):
    |   File "<cattrs generated structure esbonio.sphinx_agent.types.CreateApplicationResponse>", line 10, in structure_CreateApplicationResponse
    |     res['result'] = __c_structure_result(o['result'], __c_type_result)
    |   File "<cattrs generated structure esbonio.sphinx_agent.types.SphinxInfo>", line 39, in structure_SphinxInfo
    |     if errors: raise __c_cve('While structuring ' + 'SphinxInfo', errors, __cl)
    | cattrs.errors.ClassValidationError: While structuring SphinxInfo (1 sub-exception)
    | Structuring class CreateApplicationResponse @ attribute result
    +-+---------------- 1 ----------------
      | Traceback (most recent call last):
      |   File "<cattrs generated structure esbonio.sphinx_agent.types.SphinxInfo>", line 35, in structure_SphinxInfo
      |     res['dbpath'] = __c_structure_dbpath(o['dbpath'])
      | KeyError: 'dbpath'
      | Structuring class SphinxInfo @ attribute dbpath
      +------------------------------------

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/lextm/.vscode/extensions/swyddfa.esbonio-0.92.1/bundled/libs/pygls/protocol/json_rpc.py", line 443, in data_received
    self._data_received(data)
  File "/Users/lextm/.vscode/extensions/swyddfa.esbonio-0.92.1/bundled/libs/pygls/protocol/json_rpc.py", line 475, in _data_received
    json.loads(
  File "/Users/lextm/.pyenv/versions/3.8.16/lib/python3.8/json/__init__.py", line 370, in loads
    return cls(**kw).decode(s)
  File "/Users/lextm/.pyenv/versions/3.8.16/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/Users/lextm/.pyenv/versions/3.8.16/lib/python3.8/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
  File "/Users/lextm/.vscode/extensions/swyddfa.esbonio-0.92.1/bundled/libs/pygls/protocol/json_rpc.py", line 344, in _deserialize_message
    raise JsonRpcInvalidParams() from exc
pygls.exceptions.JsonRpcInvalidParams: Invalid Params

The Git repo is https://github.com/lextudio/pysnmp.

So it might be the same issue or just another.