{"record":{"id":"a2cc972e2c8a6372","repo":"kubernetes/kubernetes","slug":"failed-to-run-q-s-s","errorCode":null,"errorMessage":"failed to run %q: %s (%s)","messagePattern":"failed to run %q: (.+?) \\((.+?)\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/dependencyverifier/dependencyverifier.go","lineNumber":70,"sourceCode":"\t// references to modules in the spec.unwantedModules list, based on `go mod graph` content.\n\t// eliminating things from this list is good, and sometimes requires working with upstreams to do so.\n\tUnwantedReferences map[string][]string `json:\"unwantedReferences\"`\n\t// list of modules in the spec.unwantedModules list which are vendored\n\tUnwantedVendored []string `json:\"unwantedVendored\"`\n}\n\n// runCommand runs the cmd and returns the combined stdout and stderr, or an\n// error if the command failed.\nfunc runCommand(cmd ...string) (string, error) {\n\treturn runCommandInDir(\"\", cmd)\n}\n\nfunc runCommandInDir(dir string, cmd []string) (string, error) {\n\tc := exec.Command(cmd[0], cmd[1:]...)\n\tc.Dir = dir\n\toutput, err := c.CombinedOutput()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to run %q: %s (%s)\", strings.Join(cmd, \" \"), err, output)\n\t}\n\treturn string(output), nil\n}\n\nfunc readFile(path string) (string, error) {\n\tcontent, err := os.ReadFile(path)\n\t// Convert []byte to string and print to screen\n\treturn string(content), err\n}\n\nfunc moduleInSlice(a module, list []module, matchVersion bool) bool {\n\tfor _, b := range list {\n\t\tif b == a {\n\t\t\treturn true\n\t\t}\n\t\tif !matchVersion && b.name == a.name {\n\t\t\treturn true\n\t\t}","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/kubernetes/kubernetes/blob/b882c60b4023bdf09264c2d5d30a2cadebc240fb/cmd/dependencyverifier/dependencyverifier.go#L52-L88","documentation":"Returned by runCommandInDir in cmd/dependencyverifier/dependencyverifier.go:70 when exec.Command(...).CombinedOutput() returns a non-nil error. It wraps the joined command string, the Go exec error, and the combined output. dependencyverifier runs 'go mod graph' and 'go list -m ...' to detect unwanted/pinned dependency violations, so failures usually stem from the Go toolchain, module cache, or vendoring state.","triggerScenarios":"`go` not on PATH; run outside a Go module directory; `go mod graph` fails on a malformed go.mod; `go list` fails due to missing replace directives or broken go.work; vendor/modules.txt absent (read later) or out of sync.","commonSituations":"CI image missing Go; corrupt GOMODCACHE; go.work referencing deleted staging modules; running the verifier from the wrong working directory.","solutions":["Confirm `go` is on PATH and `go mod graph` succeeds in the repo root","Read the (%s) combined-output in the error for the underlying Go message","Run `go env` to verify GOPATH/GOMODCACHE, then `go mod download` to refresh","Ensure vendor/modules.txt is present and in sync (the tool reads it after the graph step)"],"exampleFix":"# before: go missing in CI\n- run: ./dependencyverifier dependencies.json\n# -> failed to run \"go mod graph\": exec: \"go\": executable file not found in $PATH ()\n\n# after: install Go first\n- uses: actions/setup-go@v5\n  with:\n    go-version-file: go.mod\n- run: ./dependencyverifier dependencies.json","handlingStrategy":"try-catch","validationCode":"// Pre-flight: ensure `go` is available and the module graph builds before running the verifier.\nfunc preflight() error {\n    if _, err := exec.LookPath(\"go\"); err != nil {\n        return errors.New(\"go toolchain not on PATH; install Go before running dependencyverifier\")\n    }\n    if _, err := os.Stat(\"vendor/modules.txt\"); err != nil {\n        return errors.New(\"vendor/modules.txt missing; run hack/update-vendor.sh first\")\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"// Run the verifier and surface the wrapped command/output to CI logs.\nout, err := runCommandInDir(\"\", []string{\"go\", \"mod\", \"graph\"})\nif err != nil {\n    // err already includes joined command + Go exec error + combined output\n    return fmt.Errorf(\"dependencyverifier preflight failed; inspect output: %w\", err)\n}","preventionTips":["Pin a Go toolchain version in CI and verify `go mod graph` works on a clean checkout","Run hack/update-vendor.sh so vendor/modules.txt is in sync before invoking the verifier","Read the (%s) output field — it contains the real Go error message"],"tags":["tooling","dependencyverifier","go-modules","build","vendor"],"analyzedSha":"b882c60b4023bdf09264c2d5d30a2cadebc240fb","analyzedAt":"2026-08-07T04:07:48.144Z","schemaVersion":2},"datasetVersion":"2026-08-07T07:17:06.508Z"}