Python-language-server: Request textDocument/hover failed. Message: unknown document

Created on 11 Dec 2018  路  14Comments  路  Source: microsoft/python-language-server

@Ark-kun commented on Mon Dec 10 2018

Environment data

  • VS Code version: 1.28.2
  • Extension version (available under the Extensions sidebar): 2018.11.0
  • OS and version: Debian 9
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.5.3
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A

Version: 1.28.2
Commit: 7f3ce96ff4729c91352ae6def877e59c561f4850
Date: 2018-10-17T00:20:56.183Z
Electron: 2.0.9
Chrome: 61.0.3163.100
Node.js: 8.9.3
V8: 6.1.534.41
Architecture: x64

Expected behaviour

I expect mouse hovers not to cause errors.

Actual behaviour

I get errors on mouse hovers.

Steps to reproduce:

  1. Open any Python file
  2. Point your mouse to any part of the code.

Logs

Repeated many times:

[Error - 5:13:34 PM] Request textDocument/hover failed.
  Message: unknown document
  Code: -32000 
   at Microsoft.Python.LanguageServer.Implementation.ProjectFiles.GetEntry(Uri documentUri, Boolean throwIfMissing)
   at Microsoft.Python.LanguageServer.Implementation.ProjectFiles.GetEntry(TextDocumentIdentifier document, Nullable`1 expectedVersion, ProjectEntry& entry, PythonAst& tree)
   at Microsoft.Python.LanguageServer.Implementation.Server.Hover(TextDocumentPositionParams params, CancellationToken cancellationToken)
   at Microsoft.Python.LanguageServer.Implementation.LanguageServer.Hover(JToken token, CancellationToken cancellationToken)
bug duplicate

Most helpful comment

I solved the issue by reverting back to jedi. This Analysis Engine is the exact reason I don't use Visual Studio 15.0 or 17.0.

Under preferences, you should be able to search for jedi, then click the checkbox under the following section:

Python: Jedi Enabled
    Enables Jedi as IntelliSense engine instead of Microsoft Python Analysis Engine.

All 14 comments

I have these issues too.

Another way to repro this error is by copy paste selected file in the working tree. Then this error pop ups once in few seconds and it only disappears when I restart vscode.

I don't see textDocument/didOpen sent down to the LS.

Basically if LS was restarted by VSC for whatever reason, it is not getting workspace change notifications anymore.

452

did this bug solved? I have these issues too and it's boring...

I now solve the problem by kill the LanguageServer proc, but still boring...

I still have this error, and updated newest vscode
鐗堟湰: 1.31.1
鎻愪氦: 1b8e8302e405050205e69b59abb3559592bb9e60
鏃ユ湡: 2019-02-12T02:19:29.629Z
Electron: 3.1.2
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Linux x64 4.15.0-45-generic

The fix is not in public builds yet. When we resolve issue it means it was fixed and tested internally. There is a major rework of the language server in progress but it is not yet ready for public release.

Any workaround for this? (particularly in VS Code)

Typical case is when new file was created and not saved as *.py and instead, just language was selected. The underlying case is that file does not have disk path/URI.

Ah, indeed. Thanks!

Hello, I got this bug too. I solved from the 'settings.json' . I was using terminal.external.osxExec : gnome-terminal.app and telemetry.enableTelemetry: false . I removed both of them and issue is disappeared for now.
edit: It happened again after 15-20 mins.

Folding into #597

I solved the issue by reverting back to jedi. This Analysis Engine is the exact reason I don't use Visual Studio 15.0 or 17.0.

Under preferences, you should be able to search for jedi, then click the checkbox under the following section:

Python: Jedi Enabled
    Enables Jedi as IntelliSense engine instead of Microsoft Python Analysis Engine.

@MarkMoretto - did you use LS 0.1 or 0.2? 0.2 is vastly different from VS. You can try it by setting download to beta channel.

"python.analysis.downloadChannel": "beta"
Was this page helpful?
0 / 5 - 0 ratings