go system_error ai_generated true

error: exit status 127

ID: go/os-exec-command-exit-status-127

Also available as: JSON · Markdown · 中文
80%Fix Rate
85%Confidence
0Evidence
2025-12-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
1.20 active
1.21 active

Root Cause

The executed command returned exit code 127, typically meaning 'command not found' in Unix-like systems.

generic

中文

执行的命令返回退出码127,通常表示在类Unix系统中“命令未找到”。

Workarounds

  1. 90% success Capture stderr and check for 'not found' message
    cmd := exec.Command("command")
    var stderr bytes.Buffer
    cmd.Stderr = &stderr
    if err := cmd.Run(); err != nil {
        if strings.Contains(stderr.String(), "not found") { /* handle */ }
    }

Dead Ends

Common approaches that don't work:

  1. Assuming it's always a missing dependency 50% fail

    Could be due to wrong path or shell script issue; check stderr.