wtfutil/wtf · error

could not get docker system info: %w

Error message

could not get docker system info: %w

What it means

The docker widget's getSystemInfo calls cli.Info(ctx); if the Docker daemon request fails, the error is stringified via fmt.Errorf(...).Error() into the widget's display buffer. This means the widget cannot talk to the Docker daemon's /info endpoint. Note the code converts an error to a string and returns it as display text rather than propagating it.

Source

Thrown at modules/docker/client.go:17

package docker

import (
	"context"
	"fmt"
	"sort"
	"strings"

	"github.com/docker/docker/api/types"
	"github.com/docker/docker/api/types/container"
	"github.com/dustin/go-humanize"
)

func (widget *Widget) getSystemInfo() string {
	info, err := widget.cli.Info(context.Background())
	if err != nil {
		return fmt.Errorf("could not get docker system info: %w", err).Error()
	}

	diskUsage, err := widget.cli.DiskUsage(context.Background(), types.DiskUsageOptions{})
	if err != nil {
		return fmt.Errorf("could not get disk usage: %w", err).Error()
	}

	var duContainer int64
	for _, c := range diskUsage.Containers {
		duContainer += c.SizeRw
	}
	var duImg int64
	for _, im := range diskUsage.Images {
		duImg += im.Size
	}
	var duVol int64
	for _, v := range diskUsage.Volumes {
		duVol += v.UsageData.Size

View on GitHub (pinned to bb838c1ccb)

Solutions

  1. Verify the daemon is up: docker info in the same environment/terminal.
  2. Check DOCKER_HOST and DOCKER_CONTEXT env vars match the intended daemon.
  3. Fix socket permissions: add your user to the docker group or use sudo/rootless setup correctly.
  4. Restart Docker Desktop / systemctl restart docker if the daemon stalled.

Example fix

// before
info, err := widget.cli.Info(context.Background())
if err != nil {
	return fmt.Errorf("could not get docker system info: %w", err).Error()
}
// after
info, err := widget.cli.Info(context.Background())
if err != nil {
	return fmt.Errorf("could not get docker system info: %w", err).Error() // surface DOCKER_HOST & ping daemon in setup docs
}
Defensive patterns

Strategy: fallback

Validate before calling

if _, err := net.Dial("unix", "/var/run/docker.sock"); err != nil {
	// daemon socket unreachable — show setup hint instead of calling Info
}

Type guard

func isDaemonUnreachable(err error) bool {
	return errors.Is(err, syscall.ECONNREFUSED) || errors.Is(err, os.ErrNotExist) || errors.Is(err, syscall.EACCES)
}

Try / catch

info, err := widget.cli.Info(ctx)
if err != nil {
	widget.displayBuffer = fmt.Sprintf("docker unavailable: %v — check 'docker info'", err)
	return // degrade gracefully, retry on next refresh tick
}

Prevention

When it happens

Trigger: cli.Info fails: Docker daemon not running, DOCKER_HOST points to an unreachable host, permission denied on /var/run/docker.sock, or the daemon restarts mid-session.

Common situations: Docker Desktop not started, user not in the docker group, remote DOCKER_HOST with a dead tunnel, or snap/docker rootless installs with different socket paths.

Related errors


AI-assisted analysis of wtfutil/wtf@bb838c1ccb (2026-09-03). Data as JSON: /api/errors/982314201be897a0. Report an issue: GitHub.