{"record":{"id":"18f190a856188cfd","repo":"abiosoft/colima","slug":"failed-to-execute-v-w","errorCode":null,"errorMessage":"failed to execute %v: %w","messagePattern":"failed to execute (.+?): %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"util/macos.go","lineNumber":149,"sourceCode":"\n// RosettaRunning checks if Rosetta process is running.\nfunc RosettaRunning() bool {\n\tif !MacOS() {\n\t\treturn false\n\t}\n\tcmd := cli.Command(\"pgrep\", \"oahd\")\n\tcmd.Stderr = nil\n\tcmd.Stdout = nil\n\treturn cmd.Run() == nil\n}\n\n// macOSProductVersion returns the host's macOS version.\nfunc macOSProductVersion() (*semver.Version, error) {\n\tcmd := exec.Command(\"sw_vers\", \"-productVersion\")\n\t// output is like \"12.3.1\\n\"\n\tb, err := cmd.Output()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to execute %v: %w\", cmd.Args, err)\n\t}\n\tverTrimmed := strings.TrimSpace(string(b))\n\t// macOS 12.4 returns just \"12.4\\n\"\n\tfor strings.Count(verTrimmed, \".\") < 2 {\n\t\tverTrimmed += \".0\"\n\t}\n\tverSem, err := semver.NewVersion(verTrimmed)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse macOS version %q: %w\", verTrimmed, err)\n\t}\n\treturn verSem, nil\n}\n","sourceCodeStart":131,"sourceCodeEnd":162,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/util/macos.go#L131-L162","documentation":"macOSProductVersion runs sw_vers -productVersion via cmd.Output(); this error means the process could not be executed or exited non-zero. The %v shows the exact argv ([sw_vers -productVersion]). The sole caller (minMacOSVersion, error 276) downgrades it to a warning and assumes an unknown/older version.","triggerScenarios":"sw_vers missing from PATH or not executable; process spawn blocked by sandbox/MDM policy; subprocess killed before producing stdout.","commonSituations":"Heavily restricted macOS hosts; sandboxed test harnesses; broken PATH in daemon contexts where /usr/bin is absent.","solutions":["Verify with: sw_vers -productVersion; echo $? in the same environment","Fix PATH so /usr/bin/sw_vers resolves","Treat the host as version-unknown and rely on the conservative fallback path","Loosen the sandbox policy if the version check is required"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// probe once, cache the answer\nvar swVersAvailable bool\nfunc init() {\n    _, err := exec.LookPath(\"sw_vers\")\n    swVersAvailable = err == nil\n}","typeGuard":null,"tryCatchPattern":"ver, err := macOSVersion() // wrapper around sw_vers\nif err != nil {\n    // assume unknown/older macOS and take the conservative path\n    log.Printf(\"warning: %v; assuming older macOS\", err)\n    return legacyPath()\n}","preventionTips":["Cache the sw_vers result once instead of re-running it per check","Verify /usr/bin is on PATH in daemon/launchd environments that call version gates"],"tags":["macos","subprocess","version","environment"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}