dagger/dagger · error

failed to inspect image: %w

Error message

failed to inspect image: %w

What it means

This wrapped error comes from create when the backend's ImageExists check (an image inspect under the hood) itself returns an error. It is not 'image missing' (that triggers a pull) but a failure of the inspection call — usually daemon connectivity or an internal runtime error. The original error is wrapped with %w so callers can unwrap it.

Source

Thrown at engine/client/drivers/container.go:277

		slog.Warn("failed to list containers", "error", err)
		leftoverEngines = []string{}
	}

	for i, leftoverEngine := range leftoverEngines {
		// if we already have a container with that name, attempt to start it
		if leftoverEngine == containerName {
			if err := d.backend.ContainerStart(ctx, leftoverEngine); err != nil {
				return nil, fmt.Errorf("failed to start container: %w", err)
			}
			d.garbageCollectEngines(ctx, opts.cleanup, nil, slices.Delete(leftoverEngines, i, i+1))
			return &url.URL{Host: containerName}, nil
		}
	}

	// ensure the image is pulled
	exists, err := d.backend.ImageExists(ctx, opts.imageRef)
	if err != nil {
		return nil, fmt.Errorf("failed to inspect image: %w", err)
	}
	if !exists {
		if err := d.backend.ImagePull(ctx, opts.imageRef); err != nil {
			return nil, fmt.Errorf("failed to pull image: %w", err)
		}
	}

	volume := distconsts.EngineDefaultStateDir
	if opts.volumeName != "" {
		volume = opts.volumeName + ":" + volume
	}

	runOptions := runOpts{
		image:      opts.imageRef,
		volumes:    []string{volume},
		privileged: true,
		args:       []string{"--debug", "--debugaddr", defaultDebugListenerAddress},
		env:        opts.env,

View on GitHub (pinned to 82ba2681db)

Solutions

  1. Verify the container daemon is up: `docker info` (or `podman info`); start Docker Desktop if needed
  2. Check DOCKER_HOST / docker context points to a reachable daemon
  3. Re-run the command — transient daemon restarts cause this; ensure the context isn't canceled prematurely
  4. Check daemon logs for inspect errors if it persists

Example fix

// before
DOCKER_HOST=tcp://old-host:2375 dagger up  # daemon gone
// after
docker context use default && dagger up
Defensive patterns

Strategy: retry

Validate before calling

// probe the daemon before provisioning
ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
defer cancel()
if _, err := backend.ImageExists(ctx, imageRef); err != nil {
    return fmt.Errorf("container runtime not reachable: %w", err)
}

Try / catch

exists, err := backend.ImageExists(ctx, ref)
if err != nil {
    if errors.Is(err, context.Canceled) {
        return err
    }
    // retry once after daemon health check
}

Prevention

When it happens

Trigger: d.backend.ImageExists(ctx, opts.imageRef) returns a non-nil error while create verifies the engine image is present before running the container; Docker daemon unreachable/restarting, registry auth plugin failure during inspect, or context cancellation mid-call.

Common situations: Docker Desktop not running or restarting; DOCKER_HOST pointing at an unreachable remote; context canceled because the user Ctrl-C'd during Provision; podman socket misconfigured.

Related errors


AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05). Data as JSON: /api/errors/c0f4783515470e09. Report an issue: GitHub.