{"record":{"id":"be0c866125d0c449","repo":"containerd/containerd","slug":"failed-to-get-image-spec-w","errorCode":null,"errorMessage":"failed to get image spec: %w","messagePattern":"failed to get image spec: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cri/server/podsandbox/sandbox_run.go","lineNumber":93,"sourceCode":"\tvar (\n\t\tconfig = metadata.Config\n\t\tlabels = map[string]string{}\n\t)\n\n\tsandboxImage := c.getSandboxImageName()\n\tnormalized, err := dockerref.ParseDockerRef(sandboxImage)\n\tif err != nil {\n\t\treturn cin, fmt.Errorf(\"failed to parse image reference %q: %w\", sandboxImage, err)\n\t}\n\tpauseImage, err := c.client.GetImage(ctx, normalized.String())\n\tif err != nil {\n\t\treturn cin, fmt.Errorf(\"failed to get sandbox image %q: %w\", normalized.String(), err)\n\t}\n\n\t// Get the image spec from containerd image\n\timageSpec, err := pauseImage.Spec(ctx)\n\tif err != nil {\n\t\treturn cin, fmt.Errorf(\"failed to get image spec: %w\", err)\n\t}\n\n\tociRuntime, err := c.config.GetSandboxRuntime(config, metadata.RuntimeHandler)\n\tif err != nil {\n\t\treturn cin, fmt.Errorf(\"failed to get sandbox runtime: %w\", err)\n\t}\n\tlog.G(ctx).WithField(\"podsandboxid\", id).Debugf(\"use OCI runtime %+v\", ociRuntime)\n\n\tlabels[\"oci_runtime_type\"] = ociRuntime.Type\n\n\t// Create sandbox container root directories.\n\tsandboxRootDir := c.getSandboxRootDir(id)\n\tif err := c.os.MkdirAll(sandboxRootDir, 0755); err != nil {\n\t\treturn cin, fmt.Errorf(\"failed to create sandbox root directory %q: %w\",\n\t\t\tsandboxRootDir, err)\n\t}\n\tdefer func() {\n\t\tif retErr != nil && cleanupErr == nil {","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/containerd/containerd/blob/4246446a2bf7d03837b0244118d858799393bd80/internal/cri/server/podsandbox/sandbox_run.go#L75-L111","documentation":"Start calls pauseImage.Spec(ctx) to read the image's OCI spec from the containerd image metadata. If containerd cannot resolve the image's spec — typically because the image record exists but its manifest/config blobs are missing or unreadable — this wrapped error is returned and the sandbox is not started.","triggerScenarios":"The pause image was pulled but its blobs were deleted by aggressive GC, the image was pulled on a different snapshotter/content store, or the containerd content store is corrupted.","commonSituations":"Content-store corruption after a crash or disk-full event; pruning jobs (e.g. crictl rmi --prune) racing with sandbox creation; mixed containerd versions where image metadata formats differ; running Start concurrently with an image deletion.","solutions":["Re-pull the pause image to restore missing blobs: `crictl pull <sandbox-image>`","Check the content store for missing blobs (`ctr content ls`) and repair by re-pulling","Ensure no GC/pruning job removes the pause image while sandboxes start","Verify disk health — disk-full or I/O errors can leave partial image records","If corruption persists, restart containerd; in severe cases re-pull all required images after cleanup"],"exampleFix":"// caller-side: verify the spec is readable before use\nimageSpec, err := pauseImage.Spec(ctx)\nif err != nil {\n    // blob/manifest missing — re-pull and retry once\n    if _, perr := c.client.Pull(ctx, normalized.String(), containerd.WithPullUnpack); perr != nil {\n        return cin, fmt.Errorf(\"failed to get image spec: %w\", err)\n    }\n    pauseImage, perr = c.client.GetImage(ctx, normalized.String())\n    if perr != nil {\n        return cin, fmt.Errorf(\"failed to get image spec: %w\", perr)\n    }\n    imageSpec, err = pauseImage.Spec(ctx)\n    if err != nil {\n        return cin, fmt.Errorf(\"failed to get image spec: %w\", err)\n    }\n}","handlingStrategy":"retry","validationCode":"// Go: verify the image spec is readable before starting sandboxes\nimg, err := client.GetImage(ctx, pauseRef)\nif err == nil {\n    if _, err := img.Spec(ctx); err != nil {\n        // blobs missing — re-pull to repair the content store\n        _, _ = client.Pull(ctx, pauseRef, containerd.WithPullUnpack)\n    }\n}","typeGuard":null,"tryCatchPattern":"imageSpec, err := pauseImage.Spec(ctx)\nif err != nil {\n    // repair by re-pulling, then retry once\n    if _, perr := c.client.Pull(ctx, normalized.String(), containerd.WithPullUnpack); perr == nil {\n        if img, gerr := c.client.GetImage(ctx, normalized.String()); gerr == nil {\n            imageSpec, err = img.Spec(ctx)\n        }\n    }\n    if err != nil {\n        return cin, fmt.Errorf(\"failed to get image spec: %w\", err)\n    }\n}","preventionTips":["Stop aggressive prune jobs (crictl rmi --prune) from removing pause image blobs","Re-pull images after disk-full or crash events to repair partial content records","Monitor containerd content-store health and available disk space","Verify image integrity with `ctr images check` when specs start failing"],"tags":["containerd","cri","image-spec","oci","content-store"],"backgroundTag":"image-spec-unavailable","analyzedSha":"4246446a2bf7d03837b0244118d858799393bd80","analyzedAt":"2026-09-02T00:14:43.053Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}