You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VS Code中Go调试适配器进程意外终止,求故障排查建议

Troubleshooting "Go debug adapter process has terminated unexpectedly" in VS Code

Let’s walk through some targeted troubleshooting steps since you’ve already tried the basics (reinstalling extensions/Delve, checking environment settings):

1. Verify Delve Works Outside VS Code

First, rule out Delve itself being broken:

  • Open a command prompt and run dlv version — this should return your Delve version without errors. If it fails, reinstall Delve with:
    go install github.com/go-delve/delve/cmd/dlv@latest
    
  • Try launching a debug session directly with Delve:
    dlv debug ./your-main-file.go
    
    If this works, the issue is likely tied to VS Code’s configuration; if not, Delve has installation problems related to your Go version or Windows setup.

2. Fix Up Your Debug Configuration

Your config snippet was cut off, so let’s cover common missteps:

  • Ensure the mode field is set to a valid value (debug, test, or exec — use "mode": "debug" for standard app launches).
  • Double-check the program field points to your main file/package. Example:
    "program": "${workspaceFolder}/cmd/main.go"
    
  • Add "trace": "verbose" to your config. This will dump detailed logs to the Debug Console, showing exactly where the adapter crashes.

3. Windows-Specific Checks

Since you’re on Windows 10 x64, these are easy to miss:

  • Run VS Code as Administrator — Delve sometimes needs elevated privileges to attach to processes.
  • Temporarily disable antivirus/firewall. Some security tools block Delve’s process injection capabilities.
  • Confirm GOPATH and GOROOT match in both system environment variables and VS Code settings (go to File > Preferences > Settings and search for go.gopath/go.goroot).

4. Address Version Compatibility

Your setup uses older versions, which often cause compatibility gaps:

  • Update VS Code to the latest stable release (v1.22.2 is from 2018 and lacks modern debug adapter fixes).
  • Upgrade Go to a newer version compatible with Delve — Go 1.9.1 is outdated; aim for at least Go 1.16+.
  • If updating doesn’t help, roll back the Go extension to a version matched to your Go version. For Go 1.9, try extension v0.11.0 (known to work with older Go releases).

5. Reset Extension Settings

Corrupted settings can cause odd failures:

  • Open the command palette (Ctrl+Shift+P), run Go: Reset Go Extension Settings.
  • Restart VS Code and rebuild your debug launch config from scratch.

内容的提问来源于stack exchange,提问作者Ali Altun

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 06:18:19