Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'replace' of undefined when starting LS on Arch #3693

Closed
jakebailey opened this issue Dec 13, 2018 · 9 comments
Assignees
Labels
area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. bug Issue identified by VS Code Team member as probable bug

Comments

@jakebailey
Copy link
Member

Environment data

  • VS Code version: 1.30.0
  • Extension version (available under the Extensions sidebar): 2018.12.0
  • OS and version: Arch Linux
  • Python version (& distribution if applicable, e.g. Anaconda): 3.7.1
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A
  • Relevant/affected Python packages and their versions: N/A

Expected behavior

Python extension loads with the language server running.

Actual behavior

The extension never finishes loading ("Python extension loading..." forever), and instead throws an exception from the code added in 66f8a27.

Steps to reproduce:

  1. Start the extension with LS enabled on Arch.

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

Nothing is output.

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)

With the source map enabled:

  ERR Cannot read property 'replace' of undefined: TypeError: Cannot read property 'replace' of undefined
    at Object.SemVer [as parseVersion] (/home/jake/.vscode/extensions/ms-python.python-2018.12.0/src/client/common/utils/version.ts:12:1)
    at parseVersion (/home/jake/.vscode/extensions/ms-python.python-2018.12.0/src/client/common/platform/platformService.ts:142:1)
    at cb (/home/jake/.vscode/extensions/ms-python.python-2018.12.0/node_modules/getos/index.js:66:1)
    at cb (/home/jake/.vscode/extensions/ms-python.python-2018.12.0/node_modules/getos/index.js:125:51)
    at customLogic (/home/jake/.vscode/extensions/ms-python.python-2018.12.0/node_modules/getos/index.js:63:1)
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)
@brettcannon brettcannon added bug Issue identified by VS Code Team member as probable bug area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. needs PR labels Dec 14, 2018
@DonJayamanne
Copy link

@jakebailey
Have you enabled source maps? (do you have the setting "python.diagnostics.sourceMapsEnabled": false, in you user settings.json?
If not, then please uninstall the extension, quit vscode and reinstall the extension.

@DonJayamanne
Copy link

DonJayamanne commented Dec 14, 2018

and instead throws an exception from the code added i

What is this exception you are referring to that gets thrown?
Please could you add a screenshot of this exception message that gets thrown?

I have a suspicion what you mean by throw exception is a controlled warning message that we display.
Meaning this might not be a P0 issue.

@DonJayamanne
Copy link

Can you confirm you are able to debug a simple python file.

  • Create a python file
  • Add a print("Hello") line
  • Debug this file

Let me know if this works.

Also, are there any other errors in the console window.

@jakebailey
Copy link
Member Author

Yes, I have source maps enabled. I pasted the stack trace given in the dev tools console in my issue above. There is no output in the "output" panel for Python, no warnings, no "starting language server" message.

I can run the script I have open using the "start debugging" and it will execute (and breakpoint when I throw something).

This is what I see in the bottom bar:

image

@DonJayamanne
Copy link

DonJayamanne commented Dec 14, 2018

What's the error message you referred to?
What other errors do you have in the console window.

@jakebailey
Copy link
Member Author

I'm really confused as to what you're asking me for that's different than what I provided. The stack trace I am describing is in my original issue. This is not some sort of big pop up from the editor. Pasted again:

  ERR Cannot read property 'replace' of undefined: TypeError: Cannot read property 'replace' of undefined
    at Object.SemVer [as parseVersion] (/home/jake/.vscode/extensions/ms-python.python-2018.12.0/src/client/common/utils/version.ts:12:1)
    at parseVersion (/home/jake/.vscode/extensions/ms-python.python-2018.12.0/src/client/common/platform/platformService.ts:142:1)
    at cb (/home/jake/.vscode/extensions/ms-python.python-2018.12.0/node_modules/getos/index.js:66:1)
    at cb (/home/jake/.vscode/extensions/ms-python.python-2018.12.0/node_modules/getos/index.js:125:51)
    at customLogic (/home/jake/.vscode/extensions/ms-python.python-2018.12.0/node_modules/getos/index.js:63:1)
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)

I can run my script by clicking the "play" button just fine, which tells me that an exception gets thrown when trying to start the LS, the future that indicates that the LS has started doesn't complete, and the "extension loading" message doesn't disappear.

@DonJayamanne
Copy link

Got it, thanks.

@matejcik
Copy link

matejcik commented Dec 14, 2018

I'm seeing the same thing, commenting to clarify that this only happens when Jedi is disabled, i.e., when using Microsoft Python Language server.
Jedi server loads fine.
The same problem happens whether the LS is installed (by previous version of the python extension) or not.

(sorry for the noise if "LS" means the Microsoft language server by default)

My OS is Linux Mint 19 otherwise same version info, this doesn't seem to depend on Python version (affects multiple 3.x environments with or without virtualenvs)

@abhnvkmr
Copy link

I can confirm. Same thing is happening on KDE neon. Exact same error.

I also deleted .config/Code and vscode/extensions folder to no avail.

@DonJayamanne DonJayamanne self-assigned this Dec 14, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jan 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

5 participants