jesseduffield/lazydocker · error

{stderr}

Error message

{stderr}

What it means

This is sanitisedCommandOutput in pkg/commands/os.go: when a shell command fails with an *exec.ExitError, the raw 'exit status N' message is discarded and the command's stderr is returned as the error instead. So the literal message '{stderr}' in static analysis is really whatever the subprocess wrote to stderr — the actual failure text comes from docker, docker-compose, or whatever binary was run.

Source

Thrown at pkg/commands/os.go:149

func (c *OSCommand) FileType(path string) string {
	fileInfo, err := os.Stat(path)
	if err != nil {
		return "other"
	}
	if fileInfo.IsDir() {
		return "directory"
	}
	return "file"
}

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 stderr if we got an ExitError
		exitError, ok := err.(*exec.ExitError)
		if ok {
			return outputString, errors.New(string(exitError.Stderr))
		}
		return "", WrapError(err)
	}
	return outputString, nil
}

// OpenFile opens a file with the given
func (c *OSCommand) OpenFile(filename string) error {
	commandTemplate := c.Config.UserConfig.OS.OpenCommand
	templateValues := map[string]string{
		"filename": c.Quote(filename),
	}

	command := utils.ResolvePlaceholderString(commandTemplate, templateValues)
	err := c.RunCommand(command)
	return err
}

View on GitHub (pinned to 7e7aadc207)

Solutions

  1. Read the stderr text in the message — it is the real cause; act on what the underlying CLI (docker/docker-compose) complained about.
  2. Reproduce in a terminal: run the same docker/docker-compose command manually to see full output.
  3. For 'permission denied' on /var/run/docker.sock: `sudo usermod -aG docker $USER` and re-login.
  4. For compose file errors: `docker compose config` to validate the yaml.
Defensive patterns

Strategy: try-catch

Try / catch

out, err := osCommand.RunCommand("docker stop " + id)
if err != nil {
    // err.Error() IS the subprocess stderr; surface it verbatim to the user
    log.WithError(err).Error("docker command failed")
}

Prevention

When it happens

Trigger: Any OSCommand.RunCommand-style call whose subprocess exits non-zero: `docker stop` failing, `docker-compose up` failing, `docker system prune` being declined, etc. Only reached when err is an *exec.ExitError; other error types go through WrapError instead.

Common situations: Docker CLI reporting 'No such container', 'permission denied' on the docker socket (user not in docker group), docker-compose yaml syntax errors, or disk-full when running prune commands. The error text you see is verbatim stderr from the CLI tool.

Related errors


AI-assisted analysis of jesseduffield/lazydocker@7e7aadc207 (2026-08-15). Data as JSON: /api/errors/19ebbc296cf68046. Report an issue: GitHub.