{"record":{"id":"c0f4783515470e09","repo":"dagger/dagger","slug":"failed-to-inspect-image-w","errorCode":null,"errorMessage":"failed to inspect image: %w","messagePattern":"failed to inspect image: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/client/drivers/container.go","lineNumber":277,"sourceCode":"\t\tslog.Warn(\"failed to list containers\", \"error\", err)\n\t\tleftoverEngines = []string{}\n\t}\n\n\tfor i, leftoverEngine := range leftoverEngines {\n\t\t// if we already have a container with that name, attempt to start it\n\t\tif leftoverEngine == containerName {\n\t\t\tif err := d.backend.ContainerStart(ctx, leftoverEngine); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to start container: %w\", err)\n\t\t\t}\n\t\t\td.garbageCollectEngines(ctx, opts.cleanup, nil, slices.Delete(leftoverEngines, i, i+1))\n\t\t\treturn &url.URL{Host: containerName}, nil\n\t\t}\n\t}\n\n\t// ensure the image is pulled\n\texists, err := d.backend.ImageExists(ctx, opts.imageRef)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to inspect image: %w\", err)\n\t}\n\tif !exists {\n\t\tif err := d.backend.ImagePull(ctx, opts.imageRef); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to pull image: %w\", err)\n\t\t}\n\t}\n\n\tvolume := distconsts.EngineDefaultStateDir\n\tif opts.volumeName != \"\" {\n\t\tvolume = opts.volumeName + \":\" + volume\n\t}\n\n\trunOptions := runOpts{\n\t\timage:      opts.imageRef,\n\t\tvolumes:    []string{volume},\n\t\tprivileged: true,\n\t\targs:       []string{\"--debug\", \"--debugaddr\", defaultDebugListenerAddress},\n\t\tenv:        opts.env,","sourceCodeStart":259,"sourceCodeEnd":295,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/engine/client/drivers/container.go#L259-L295","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the container daemon is up: `docker info` (or `podman info`); start Docker Desktop if needed","Check DOCKER_HOST / docker context points to a reachable daemon","Re-run the command — transient daemon restarts cause this; ensure the context isn't canceled prematurely","Check daemon logs for inspect errors if it persists"],"exampleFix":"// before\nDOCKER_HOST=tcp://old-host:2375 dagger up  # daemon gone\n// after\ndocker context use default && dagger up","handlingStrategy":"retry","validationCode":"// probe the daemon before provisioning\nctx, cancel := context.WithTimeout(ctx, 5*time.Second)\ndefer cancel()\nif _, err := backend.ImageExists(ctx, imageRef); err != nil {\n    return fmt.Errorf(\"container runtime not reachable: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"exists, err := backend.ImageExists(ctx, ref)\nif err != nil {\n    if errors.Is(err, context.Canceled) {\n        return err\n    }\n    // retry once after daemon health check\n}","preventionTips":["Confirm `docker info` succeeds before running dagger","Avoid canceling the context mid-provision (Ctrl-C during engine start)","Keep DOCKER_HOST / docker context stable and valid"],"tags":["docker","image","daemon-connectivity"],"backgroundTag":"docker-daemon-unreachable","analyzedSha":"82ba2681dbe30d3547a1dc50ea495900ab5b6047","analyzedAt":"2026-09-05T07:21:37.930Z","contentChangedAt":"2026-09-05T07:21:37.930Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}