question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Running the debugger results in "There was an error in starting the debug server"

See original GitHub issue

Environment data

VS Code version: Version 1.19.3 (1.19.3) Python Extension version: 2018.1.0 Python Version: 2.7.13 OS and version: macOS High Sierra 10.13.2 (17C205)

Actual behavior

When attempting to debug a Python file, as soon as it is launched I get an error in the debug console as well as an alert banner with the message: There was an error in starting the debug server. Error = {"code":"ENOTFOUND","errno":"ENOTFOUND","syscall":"getaddrinfo","address":"localhost"}

The debugger does not start. I used the debugger successfully previously. That was a few months ago at this point, so I have no idea what versions are different or what has changed on the host machine.

Expected behavior

The file should be debugged as normal.

Steps to reproduce:

  • Open a .py script
  • Select the debugger tab on the left
  • Select the “Python” configuration (launch.json is below)
  • Click the run button

Logs

Output from Python output panel

There was an error in starting the debug server. Error = {"code":"ENOTFOUND","errno":"ENOTFOUND","syscall":"getaddrinfo","address":"localhost"}
There was an error in starting the debug server. Error = {"code":"ENOTFOUND","errno":"ENOTFOUND","syscall":"getaddrinfo","address":"localhost"}

Output from Console window (Help->Developer Tools menu)

/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:249 [Extension Host] Python Extension: Failed to get conda info from conda null
t.log @ /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:249
/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:2742 There was an error in starting the debug server. Error = {"code":"ENOTFOUND","errno":"ENOTFOUND","syscall":"getaddrinfo","hostname":"localhost"}
e.doShow @ /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:2742

Contents of launch.json:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python",
            "type": "python",
            "request": "launch",
            "stopOnEntry": true,
            "pythonPath": "${config:python.pythonPath}",
            "program": "${file}",
            "cwd": "${workspaceFolder}",
            "env": {},
            "envFile": "${workspaceFolder}/.env",
            "debugOptions": [
                "RedirectOutput"
            ]
        }
   ]
}

python.pythonPath is set to use the Homebrew Python at /usr/local/bin/python2

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:6
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

9reactions
DoctorDYLcommented, Mar 1, 2018

Finally, I found my macOS system hosts file is empty and I fixed this problem with adding “127.0.0.1 localhost” to hosts file.

0reactions
dalemyerscommented, Apr 3, 2018

@breadplop The hosts file tells your machine about special hostnames. More info here: https://en.wikipedia.org/wiki/Hosts_(file)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Unable to Start Debugging on the Web Server
Open your project properties and make sure that the project is configured to connect to the correct Web server and launch URL. (Open...
Read more >
I can't run code or debug of my python file in vscode
Looks like something's missing. I realized that there's no debugOption but I don't know how to fix it. It used to work fine...
Read more >
Python debugger not working while normal run does
The python debugger in Pycharm (I've the latest version) is not working for any Python file (so it's not my project or anything)....
Read more >
Application running in debug mode in the test environment not ...
To resolve this, follow these steps: Go to Windows > Preferences > Java > Debug.
Read more >
Debug Node.js Apps using Visual Studio Code
With this setting, the debugger can attach to an already running process that was not started in debug mode. When using the processId...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found