jesseduffield/lazygit · error

<dynamic: combined stdout/stderr of failed command>

Error message

<dynamic: combined stdout/stderr of failed command>

What it means

Produced by sanitisedCommandOutput in pkg/commands/oscommands/cmd_obj_runner.go:213. When a shell command fails, the raw error from os/exec (e.g. 'exit status 1') is uninformative, so lazygit replaces it with the command's combined stdout/stderr captured as the error message. This is a deliberate sanitization: the dynamic message IS the command output you need to read.

Source

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

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

	return nil
}

func (self *cmdObjRunner) logCmdObj(cmdObj *CmdObj) {
	self.guiIO.logCommandFn(cmdObj.ToString(), true)
}

func sanitisedCommandOutput(output []byte, err error) (string, error) {
	outputString := string(output)
	if err != nil {
		// errors like 'exit status 1' are not very useful so we'll create an error
		// from the combined output
		if outputString == "" {
			return "", utils.WrapError(err)
		}
		return outputString, errors.New(outputString)
	}
	return outputString, nil
}

type cmdHandler struct {
	stdoutPipe io.Reader
	stdinPipe  io.Writer
	close      func() error
	// wait blocks until the child process exits. Needed as a separate
	// field because the pty path on Windows spawns via CreateProcess and
	// never runs *exec.Cmd.Start — so cmd.Wait wouldn't work there.
	wait func() error
}

func (self *cmdObjRunner) runAndStream(cmdObj *CmdObj) error {
	return self.runAndStreamAux(cmdObj, func(handler *cmdHandler, cmdWriter io.Writer) {
		_, _ = io.Copy(cmdWriter, handler.stdoutPipe)
	})

View on GitHub (pinned to c477a2959b)

Solutions

  1. Read the error text itself: it is the real git/shell output, which usually names the actual problem (auth, permissions, network)
  2. Reproduce outside lazygit with the same git command to see full context
  3. Fix the underlying cause (credentials, remote permissions, network) rather than handling this wrapper error
  4. In custom code, check cmdObj error with errors.As / string inspection only if you need branching on failure
Defensive patterns

Strategy: try-catch

Try / catch

output, err := cmdObjRunner.RunCredential(...)
if err != nil {
    // err.Error() IS the combined stdout/stderr; log and surface it verbatim
    log.Printf("git failed: %s", err)
    return err
}

Prevention

When it happens

Trigger: Any CmdObj run through a runner that uses sanitisedCommandOutput (RunCredential, RunAndDetectCredentialRequest, etc.) where the child process exits non-zero and produced output. Examples: 'git push' rejected by remote, 'git fetch' network failure, credential helper failure — the error surfaces the combined output.

Common situations: Pushing to a branch protected on the remote, authentication expiry mid-session, ssh host key changes, disk-full during git gc, any upstream git CLI failure surfaced inside the lazygit UI.

Related errors


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