jesseduffield/lazygit · error

<dynamic: joined stderr of failed piped commands>

Error message

<dynamic: joined stderr of failed piped commands>

What it means

From OSCommand.PipeCommands in pkg/commands/oscommands/os.go:274. lazygit runs several commands in a pipeline (each stdout feeding the next stdin), and on failure collects each command's buffered stderr; if any accumulated, they are joined with newlines into a single error. This identifies which pipeline stage(s) failed.

Source

Thrown at pkg/commands/oscommands/os.go:274

		// Without the rest of the pipeline to drain them, the commands we did
		// start could block forever writing to a full pipe.
		for _, cmd := range cmds[:started] {
			_ = cmd.Process.Kill()
		}
	}

	for i, cmd := range cmds[:started] {
		if err := cmd.Wait(); err != nil {
			c.Log.Error(err)
		}

		if stderrs[i].Len() > 0 {
			finalErrors = append(finalErrors, stderrs[i].String())
		}
	}

	if len(finalErrors) > 0 {
		return errors.New(strings.Join(finalErrors, "\n"))
	}
	return nil
}

func (c *OSCommand) CopyToClipboard(str string) error {
	escaped := strings.ReplaceAll(str, "\n", "\\n")
	truncated := utils.TruncateWithEllipsis(escaped, 40)

	msg := utils.ResolvePlaceholderString(
		c.Tr.Log.CopyToClipboard,
		map[string]string{
			"str": truncated,
		},
	)
	c.LogCommand(msg, false)
	if c.UserConfig().OS.CopyToClipboardCmd != "" {
		cmdStr := utils.ResolvePlaceholderString(c.UserConfig().OS.CopyToClipboardCmd, map[string]string{
			"text": c.Cmd.Quote(str),

View on GitHub (pinned to c477a2959b)

Solutions

  1. Split the joined error by newlines; each block is one pipeline stage's stderr, in pipeline order
  2. Reconstruct the pipeline manually in a shell to see which stage fails
  3. Run 'git fsck' if object corruption is suspected
  4. Fix the environment/tool issue named in the stderr text
Defensive patterns

Strategy: try-catch

Try / catch

if err := osCommand.PipeCommands(cmds...); err != nil {
    for _, stage := range strings.Split(err.Error(), "\n") {
        log.Printf("pipeline stage stderr: %s", stage)
    }
    return err
}

Prevention

When it happens

Trigger: PipeCommands is used for pipelines like 'git cat-file --batch' | 'git apply' style chains (e.g. copy filename to clipboard pipelines or diff piping). Any stage exiting non-zero that wrote to stderr contributes its stderr to the joined error.

Common situations: Corrupt object store making an early cat-file stage fail, patch application failure in a later stage, locale/environment differences altering git stderr output inside the pipe.

Related errors


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