Skip to content

Couldn't start dlv dap: Error: No available ports found #3756

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

Open
Aatroy opened this issue Apr 21, 2025 · 1 comment
Open

Couldn't start dlv dap: Error: No available ports found #3756

Aatroy opened this issue Apr 21, 2025 · 1 comment
Labels
WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@Aatroy
Copy link

Aatroy commented Apr 21, 2025

Image

{ // 使用 IntelliSense 了解相关属性。 // 悬停以查看现有属性的描述。 // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "main", "type": "go", "request": "launch", "mode": "debug", "cwd": "./", "program": "main.go", } ] }

launch.json like this.

when I run dlv in vscode debug , the command while execute /usr/local/go/bin/dlv dap --listen=127.0.0.1:45863 --log-dest=3 from /projects/path

but some times , the Error happened . And I run debug repeatedly multiple times will solve the problem. How can I fundamentally solve such a problem?

@gopherbot gopherbot added this to the Untriaged milestone Apr 21, 2025
@h9jiang
Copy link
Member

h9jiang commented Apr 23, 2025

Hi @Aatroy, Thanks for reporting the issue.

I was not able to re-produce the issue you encountered. My experience is normally smooth.

See goDebugFactory.ts the vscode go extension need to find an available port and the port will be passed to dlv --listen flag.

Looks like the error happened even before the dlv is running. VSCode-Go uses the "get-port" (npm install get-port) to Get an available TCP port. If no port is available, it will throw an error throw new Error('No available ports found'); See source.

The version we are using is pretty old though. But I do not find a lot diff between the v5.1.1 and the v7.1.0 (latest).

Could you check if there is port available in your localhost though? I think this is not related to which code base you are trying to debug.

@h9jiang h9jiang added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

3 participants