{"record":{"id":"8b1e963722dd4c34","repo":"go-delve/delve","slug":"error-running-go-list-v-output-q","errorCode":null,"errorMessage":"error running go list %v: output %q","messagePattern":"error running go list (.+?): output %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"service/rpc2/client.go","lineNumber":639,"sourceCode":"\ntype goListEntry struct {\n\tDir        string\n\tImportPath string\n\tName       string\n\tModule     *goListModule\n}\n\ntype goListModule struct {\n\tPath string\n}\n\n// MakeGuessSusbtitutePathIn returns a mapping from modules to client\n// directories using \"go list\".\nfunc MakeGuessSusbtitutePathIn() (*api.GuessSubstitutePathIn, error) {\n\tcmd := exec.Command(\"go\", \"list\", \"--json\", \"all\")\n\tbuf, err := cmd.Output()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error running go list %v: output %q\", err, string(buf))\n\t}\n\timportPathOfMainPackage := \"\"\n\timportPathOfMainPackageOk := true\n\tmod2dir := make(map[string]string)\n\td := json.NewDecoder(bytes.NewReader(buf))\n\tfor d.More() {\n\t\tvar e goListEntry\n\t\terr := d.Decode(&e)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif e.Module == nil {\n\t\t\tcontinue\n\t\t}\n\t\tif !strings.HasPrefix(e.ImportPath, e.Module.Path) {\n\t\t\tcontinue\n\t\t}\n\t\tpkgWithoutModule := e.ImportPath[len(e.Module.Path):]","sourceCodeStart":621,"sourceCodeEnd":657,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/service/rpc2/client.go#L621-L657","documentation":"MakeGuessSusbtitutePathIn runs 'go list --json all' to build a module-to-directory mapping for substitute-path guessing; if the command fails, the error (including the captured output) is returned wrapped in this message. Typically means the Go toolchain is missing or the module graph is broken.","triggerScenarios":"Calling the GuessSubstitutePathIn RPC (or the client helper) in an environment where exec.Command(\"go\",\"list\",\"--json\",\"all\") exits non-zero.","commonSituations":"go not installed or not on PATH in the debug session; go.mod/go.sum inconsistent (missing requirements); GOFLAGS/GOPROXY misconfigured; network blocked during module download.","solutions":["Ensure 'go' is installed and on PATH: run 'go version' in the target's working directory","Run 'go list --json all' manually in the program directory to see the real error","Run 'go mod tidy' to fix inconsistent module requirements","Check GOPROXY/GOFLAGS environment variables and network access"],"exampleFix":"// before\nsub, err := client.MakeGuessSusbtitutePathIn() // fails: go not found\n// after (ensure env)\ncmd.Env = append(os.Environ(), \"PATH=\"+goBinDir+\":\"+os.Getenv(\"PATH\"))\nsub, err := client.MakeGuessSusbtitutePathIn()","handlingStrategy":"validation","validationCode":"if _, err := exec.LookPath(\"go\"); err != nil { return fmt.Errorf(\"go toolchain required\") }\nif _, err := os.Stat(\"go.mod\"); err != nil { return fmt.Errorf(\"run in module directory\") }","typeGuard":null,"tryCatchPattern":"sub, err := client.MakeGuessSusbtitutePathIn()\nif err != nil && strings.Contains(err.Error(), \"error running go list\") {\n    // fall back to manually configured substitute paths\n}","preventionTips":["Verify 'go version' works in the target's environment before using GuessSubstitutePathIn","Run 'go mod tidy' after dependency changes","Keep GOPROXY/network reachable in CI debug environments","Configure substitutePath manually as a fallback"],"tags":["go-toolchain","rpc2","substitute-path"],"backgroundTag":"go-list-command-failed","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}