docker/compose · warning

unexpected status code: %d

Error message

unexpected status code: %d

What it means

internal/desktop.Client's Ping (GET on the DD backend API, typically /ping) returned any HTTP status other than 200, so the response body is not decoded and this generic status error is returned. The client talks to Docker Desktop's internal backend over its socket; a non-200 usually means version skew (endpoint missing/renamed), auth rejection, or the backend being in a bad state. Callers use Ping to decide whether Docker Desktop integration (and its feature flags) is available.

Source

Thrown at internal/desktop/client.go:127

}

// Ping is a minimal API used to ensure that the server is available.
func (c *Client) Ping(ctx context.Context) (*PingResponse, error) {
	req, err := c.newRequest(ctx, http.MethodGet, "/ping", http.NoBody)
	if err != nil {
		return nil, err
	}

	resp, err := c.client.Do(req)
	if err != nil {
		return nil, err
	}
	defer func() {
		_ = resp.Body.Close()
	}()

	if resp.StatusCode != http.StatusOK {
		return nil, fmt.Errorf("unexpected status code: %d", resp.StatusCode)
	}

	var ret PingResponse
	if err := json.NewDecoder(resp.Body).Decode(&ret); err != nil {
		return nil, err
	}
	return &ret, nil
}

type FeatureFlagResponse map[string]FeatureFlagValue

type FeatureFlagValue struct {
	Enabled bool `json:"enabled"`
}

func (c *Client) FeatureFlags(ctx context.Context) (FeatureFlagResponse, error) {
	req, err := c.newRequest(ctx, http.MethodGet, "/features", http.NoBody)
	if err != nil {

View on GitHub (pinned to ddc4b044b6)

Solutions

  1. Update Docker Desktop to a version matching your compose release (bundle skew is the most common cause).
  2. Restart Docker Desktop so its backend API is fully up, then retry the compose command.
  3. Inspect what the backend actually returns: curl --unix-socket <dd-socket> http://localhost/ping and check the status/body.
  4. If you do not need DD integration, set DOCKER_HOST to the plain engine socket so the desktop client is not used.
  5. Code that treats Ping failure as 'DD not present' should degrade gracefully rather than failing the command.

Example fix

// caller degrades gracefully instead of failing
if _, err := client.Ping(ctx); err != nil {
    // Docker Desktop integration unavailable; continue without it
    slog.Debug("desktop ping failed", "err", err)
    return nil
}
Defensive patterns

Strategy: fallback

Validate before calling

// preflight with a plain HTTP call before relying on the client
resp, err := http.Get(ddPingURL) // over the DD socket transport
if err != nil || resp.StatusCode != http.StatusOK {
    // skip desktop integration for this run
}

Try / catch

if _, err := client.Ping(ctx); err != nil {
    // degrade: treat Docker Desktop as absent, do not fail the command
    slog.Debug("docker desktop unavailable", "err", err)
    useDesktopIntegration = false
}

Prevention

When it happens

Trigger: Calling desktop.Client.Ping when the DD backend answered with e.g. 404 (old DD without the endpoint), 401/403 (auth-protected backend), 500 (backend crash), or a redirect followed by an error page from a proxy in front of the socket.

Common situations: Old Docker Desktop version predating the backend API used by a newer compose binary; mixed installs where DOCKER_HOST points at DD's socket but the desktop app is half-upgraded; CI environments with a Docker Desktop-like socket proxy; DD backend restarting exactly when compose pings it.

Related errors


AI-assisted analysis of docker/compose@ddc4b044b6 (2026-08-15). Data as JSON: /api/errors/e24aa3cbc19ae464. Report an issue: GitHub.