abiosoft/colima · warning
failed to execute %v: %w
Error message
failed to execute %v: %w
What it means
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.
Source
Thrown at util/macos.go:149
// RosettaRunning checks if Rosetta process is running.
func RosettaRunning() bool {
if !MacOS() {
return false
}
cmd := cli.Command("pgrep", "oahd")
cmd.Stderr = nil
cmd.Stdout = nil
return cmd.Run() == nil
}
// macOSProductVersion returns the host's macOS version.
func macOSProductVersion() (*semver.Version, error) {
cmd := exec.Command("sw_vers", "-productVersion")
// output is like "12.3.1\n"
b, err := cmd.Output()
if err != nil {
return nil, fmt.Errorf("failed to execute %v: %w", cmd.Args, err)
}
verTrimmed := strings.TrimSpace(string(b))
// macOS 12.4 returns just "12.4\n"
for strings.Count(verTrimmed, ".") < 2 {
verTrimmed += ".0"
}
verSem, err := semver.NewVersion(verTrimmed)
if err != nil {
return nil, fmt.Errorf("failed to parse macOS version %q: %w", verTrimmed, err)
}
return verSem, nil
}
View on GitHub (pinned to c3a5f9184d)
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
Defensive patterns
Strategy: fallback
Validate before calling
// probe once, cache the answer
var swVersAvailable bool
func init() {
_, err := exec.LookPath("sw_vers")
swVersAvailable = err == nil
} Try / catch
ver, err := macOSVersion() // wrapper around sw_vers
if err != nil {
// assume unknown/older macOS and take the conservative path
log.Printf("warning: %v; assuming older macOS", err)
return legacyPath()
} Prevention
- 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
When it happens
Trigger: sw_vers missing from PATH or not executable; process spawn blocked by sandbox/MDM policy; subprocess killed before producing stdout.
Common situations: Heavily restricted macOS hosts; sandboxed test harnesses; broken PATH in daemon contexts where /usr/bin is absent.
Related errors
- error retrieving macOS version: %w
- failed to parse macOS version %q: %w
- error during Lima prune: %w
- error in config: %w
- error editing config file: %w
AI-assisted analysis of abiosoft/colima@c3a5f9184d (2026-08-15).
Data as JSON: /api/errors/18f190a856188cfd.
Report an issue: GitHub.