jesseduffield/lazygit · error

<dynamic: stdout of failed command>

Error message

<dynamic: stdout of failed command>

What it means

Returned from the streaming runner in pkg/commands/oscommands/cmd_obj_runner.go:321. It is the fallback after stderr was empty and the command did not opt into ShouldIgnoreEmptyError: if stdout is non-empty on a failed command, that stdout becomes the error. Some tools report failures on stdout only, so lazygit surfaces whichever stream had content.

Source

Thrown at pkg/commands/oscommands/cmd_obj_runner.go:321

	self.log.Infof("%s (%s)", cmdObj.ToString(), time.Since(t))

	if err != nil {
		if cmdObj.suppressOutputUnlessError {
			_, _ = self.guiIO.newCmdWriterFn().Write(combinedOutput.Bytes())
		}

		errStr := stderr.String()
		if errStr != "" {
			return errors.New(errStr)
		}

		if cmdObj.ShouldIgnoreEmptyError() {
			return nil
		}
		stdoutStr := stdout.String()
		if stdoutStr != "" {
			return errors.New(stdoutStr)
		}
		return errors.New("Command exited with non-zero exit code, but no output")
	}

	return nil
}

type CredentialType int

const (
	Password CredentialType = iota
	Username
	Passphrase
	PIN
	Token
)

// Whenever we're asked for a password we return a nil channel to tell the

View on GitHub (pinned to c477a2959b)

Solutions

  1. Read the error text; it is the captured stdout of the failed command
  2. Identify which command failed via the lazygit command log (it records cmdObj.ToString())
  3. Fix or reconfigure the failing external tool (path, arguments, exit behavior)
  4. If empty-output failures are expected noise for this command, construct the CmdObj with the option that ignores empty errors
Defensive patterns

Strategy: try-catch

Try / catch

err := cmd.Run()
if err != nil {
    msg := err.Error()
    // stdout-only failures: some tools print errors on stdout
    if strings.HasPrefix(msg, "error:") || strings.Contains(msg, "fatal:") {
        return fmt.Errorf("external tool failed: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: A streamed CmdObj exits non-zero, wrote nothing to stderr, did not set ShouldIgnoreEmptyError, but wrote to stdout. Typical for tools that print their error report to stdout (some diff drivers, hooks, or custom pager/diff tooling configured in lazygit).

Common situations: Custom diff tools or diffRenderers misconfigured and failing with output on stdout; git hooks printing failure text to stdout; external merge tools exiting non-zero.

Related errors


AI-assisted analysis of jesseduffield/lazygit@c477a2959b (2026-08-15). Data as JSON: /api/errors/1f118a29b5b75c12. Report an issue: GitHub.