{"record":{"id":"abd7a5807d1a5ec0","repo":"github/copilot-sdk","slug":"go-list-failed-s","errorCode":null,"errorMessage":"go list failed: %s","messagePattern":"go list failed: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/cmd/bundler/main.go","lineNumber":289,"sourceCode":"\n\tfmt.Printf(\"Found copilot-sdk %s in go.mod\\n\", sdkVersion)\n\n\t// Fetch package.json from the SDK repo at that version\n\tcliVersion, err := fetchCLIVersionFromRepo(sdkVersion)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to fetch CLI version: %w\", err)\n\t}\n\n\treturn cliVersion, nil\n}\n\n// getSDKVersion runs \"go list -m\" to get the copilot-sdk version from go.mod\nfunc getSDKVersion() (string, error) {\n\tcmd := exec.Command(\"go\", \"list\", \"-m\", \"-f\", \"{{.Version}}\", sdkModule)\n\toutput, err := cmd.Output()\n\tif err != nil {\n\t\tif exitErr, ok := err.(*exec.ExitError); ok {\n\t\t\treturn \"\", fmt.Errorf(\"go list failed: %s\", string(exitErr.Stderr))\n\t\t}\n\t\treturn \"\", err\n\t}\n\n\tversion := strings.TrimSpace(string(output))\n\tif version == \"\" {\n\t\treturn \"\", fmt.Errorf(\"module %s not found in go.mod\", sdkModule)\n\t}\n\n\treturn version, nil\n}\n\n// fetchCLIVersionFromRepo fetches package.json from GitHub and extracts the CLI version.\nfunc fetchCLIVersionFromRepo(sdkVersion string) (string, error) {\n\t// Convert Go module version to Git ref\n\t// v0.1.0 -> v0.1.0\n\t// v0.1.0-beta.1 -> v0.1.0-beta.1\n\t// v0.0.0-20240101120000-abcdef123456 -> abcdef123456 (pseudo-version)","sourceCodeStart":271,"sourceCodeEnd":307,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/go/cmd/bundler/main.go#L271-L307","documentation":"getSDKVersion shells out to `go list -m -f {{.Version}} <sdkModule>`. If the command exits nonzero, the captured stderr is surfaced as 'go list failed: <stderr>'. This reports exactly why Go's module tooling refused to resolve the copilot-sdk module.","triggerScenarios":"copilot-sdk is not a requirement of the current module, the go.mod/go.sum are inconsistent, the module is replaced to an invalid path, or `go` itself errors (bad toolchain, corrupt cache).","commonSituations":"Running the bundler outside the module that requires copilot-sdk; a broken replace directive; go.sum mismatch ('missing go.sum entry'); wrong Go toolchain version.","solutions":["Read the stderr shown in the error and address the `go list` cause directly","Run `go mod tidy` from the module root to restore go.mod/go.sum consistency","Confirm copilot-sdk appears in go.mod's require block","Retry from the directory containing go.mod"],"exampleFix":"// before: go list failed: no required module provides package ...\n// after:\n// $ cd /path/to/module\n// $ go get github.com/github/copilot-sdk@latest && go mod tidy","handlingStrategy":"validation","validationCode":"if _, err := exec.LookPath(\"go\"); err != nil {\n    return errors.New(\"go toolchain required\")\n}\nout, err := exec.Command(\"go\", \"list\", \"-m\", \"all\").Output()\nif err != nil || !bytes.Contains(out, []byte(\"copilot-sdk\")) {\n    return errors.New(\"copilot-sdk not in module graph\")\n}","typeGuard":null,"tryCatchPattern":"if err != nil {\n    if exitErr, ok := err.(*exec.ExitError); ok {\n        log.Fatalf(\"go list failed: %s\", exitErr.Stderr) // surface stderr to the user\n    }\n}","preventionTips":["Run `go mod tidy` and commit consistent go.mod/go.sum","Verify with `go list -m <sdkModule>` before bundling","Keep the Go toolchain at the version go.mod requires"],"tags":["go","modules","command","dependency"],"backgroundTag":"git-command-failed","analyzedSha":"cd8cf15dc3f9e762615790aaed0a771a0f392755","analyzedAt":"2026-09-09T18:32:31.973Z","contentChangedAt":"2026-09-09T18:32:31.973Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}