{"record":{"id":"88ef193981f4ee38","repo":"jesseduffield/lazygit","slug":"command-exited-with-non-zero-exit-code-but-no-out","errorCode":null,"errorMessage":"Command exited with non-zero exit code, but no output","messagePattern":"Command exited with non-zero exit code, but no output","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/commands/oscommands/cmd_obj_runner.go","lineNumber":323,"sourceCode":"\n\tif err != nil {\n\t\tif cmdObj.suppressOutputUnlessError {\n\t\t\t_, _ = self.guiIO.newCmdWriterFn().Write(combinedOutput.Bytes())\n\t\t}\n\n\t\terrStr := stderr.String()\n\t\tif errStr != \"\" {\n\t\t\treturn errors.New(errStr)\n\t\t}\n\n\t\tif cmdObj.ShouldIgnoreEmptyError() {\n\t\t\treturn nil\n\t\t}\n\t\tstdoutStr := stdout.String()\n\t\tif stdoutStr != \"\" {\n\t\t\treturn errors.New(stdoutStr)\n\t\t}\n\t\treturn errors.New(\"Command exited with non-zero exit code, but no output\")\n\t}\n\n\treturn nil\n}\n\ntype CredentialType int\n\nconst (\n\tPassword CredentialType = iota\n\tUsername\n\tPassphrase\n\tPIN\n\tToken\n)\n\n// Whenever we're asked for a password we return a nil channel to tell the\n// caller to kill the process.\nvar failPromptFn = func(CredentialType) <-chan string {","sourceCodeStart":305,"sourceCodeEnd":341,"githubUrl":"https://github.com/jesseduffield/lazygit/blob/c477a2959b229fbf3284be0d4d2904ab61ec3c94/pkg/commands/oscommands/cmd_obj_runner.go#L305-L341","documentation":"The final fallback in the streaming runner (cmd_obj_runner.go:323): the command exited non-zero, stderr was empty, ShouldIgnoreEmptyError was false, and stdout was also empty. lazygit has literally nothing to show, so it tells you the command failed silently — you must inspect the exit code path yourself.","triggerScenarios":"A streamed command fails with no output on either stream. Common with tools killed by signals, sandboxed commands blocked from writing, or commands that fail fast before printing anything (e.g. missing binary executed via a wrapper).","commonSituations":"Missing executable in PATH for a configured external tool, command killed by OOM or sandbox policy, Windows path issues launching a tool, exit-code-only failures from strict tools.","solutions":["Check the lazygit command log for the exact command line, then run it in a terminal to see its exit code ('$?')","Verify the binary exists in PATH and is executable","Check system logs (dmesg/OOM, sandbox denials) for evidence the process was killed","If this failure mode is acceptable for the command, build the CmdObj with the ignore-empty-error option so it yields nil"],"exampleFix":"// before\ncmdObj := c.OS().Cmd.New(args) // fails silently => opaque error\n\n// after\ncmdObj := c.OS().Cmd.New(args).IgnoreEmptyError() // empty-output failure returns nil","handlingStrategy":"validation","validationCode":"// Before wiring an external tool into lazygit, verify it runs and produces output:\nfunc checkToolExists(path string) error {\n    _, err := exec.LookPath(path)\n    if err != nil {\n        return fmt.Errorf(\"external tool %q not found in PATH\", path)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"if err := cmd.Run(); err != nil {\n    if err.Error() == \"Command exited with non-zero exit code, but no output\" {\n        // inspect exit status via the command log; likely missing binary or killed process\n        return fmt.Errorf(\"%s failed silently; check PATH and permissions\", cmd.ToString())\n    }\n    return err\n}","preventionTips":["Smoke-test every configured external command from a shell first","Ensure tools are on PATH in the environment lazygit was launched from","Use the command log (cmdObj.ToString()) to get the exact failing command"],"tags":["git","subprocess","exit-code","debugging"],"backgroundTag":null,"analyzedSha":"c477a2959b229fbf3284be0d4d2904ab61ec3c94","analyzedAt":"2026-08-15T08:34:32.451Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}