{"record":{"id":"ffd30e02740bf8e6","repo":"dagger/dagger","slug":"unmarshal-host-image-index-w","errorCode":null,"errorMessage":"unmarshal host image index: %w","messagePattern":"unmarshal host image index: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/schema/host.go","lineNumber":729,"sourceCode":"\tswitch desc.MediaType {\n\tcase ocispec.MediaTypeImageManifest, images.MediaTypeDockerSchema2Manifest:\n\t\tif _, err := store.Info(ctx, desc.Digest); err != nil {\n\t\t\tif cerrdefs.IsNotFound(err) {\n\t\t\t\treturn nil, true, nil\n\t\t\t}\n\t\t\treturn nil, false, fmt.Errorf(\"stat host manifest %s: %w\", desc.Digest, err)\n\t\t}\n\t\treturn &desc, true, nil\n\n\tcase ocispec.MediaTypeImageIndex, images.MediaTypeDockerSchema2ManifestList:\n\t\tindexBlob, err := content.ReadBlob(ctx, store, desc)\n\t\tif err != nil {\n\t\t\treturn nil, false, fmt.Errorf(\"read host image index blob: %w\", err)\n\t\t}\n\n\t\tvar idx ocispec.Index\n\t\tif err := json.Unmarshal(indexBlob, &idx); err != nil {\n\t\t\treturn nil, false, fmt.Errorf(\"unmarshal host image index: %w\", err)\n\t\t}\n\n\t\tmatched := false\n\t\tfor _, manifest := range idx.Manifests {\n\t\t\tswitch manifest.MediaType {\n\t\t\tcase ocispec.MediaTypeImageManifest, images.MediaTypeDockerSchema2Manifest,\n\t\t\t\tocispec.MediaTypeImageIndex, images.MediaTypeDockerSchema2ManifestList:\n\t\t\tdefault:\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif manifest.Platform != nil && !matcher.Match(*manifest.Platform) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ttarget, childMatched, err := resolveHostStoreManifestMatch(ctx, store, manifest, matcher)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, false, err\n\t\t\t}\n\t\t\tmatched = matched || childMatched","sourceCodeStart":711,"sourceCodeEnd":747,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/schema/host.go#L711-L747","documentation":"After successfully reading the host image index blob, the code unmarshals it into an OCI Index struct. If the blob is not valid JSON or not a well-formed OCI index, json.Unmarshal fails and the error is wrapped with this prefix.","triggerScenarios":"Calling Host.containerImage where the cached index blob in the host content store is corrupted, truncated, or not actually an OCI image index despite its media type.","commonSituations":"Disk corruption or interrupted writes to the content store; blobs produced/tampered with by third-party tools; unusual media types with non-index payloads.","solutions":["Remove the corrupted image from the local store and re-pull it (dag.Container().from forces a fresh fetch).","Verify the blob integrity (crane/digest check) if you suspect a corrupted engine cache; restart the engine afterwards.","If a mirror/proxy serves the blob, check it for corruption or truncation."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { img = await dag.host().containerImage(name) } catch (e) { if (String(e).includes(\"unmarshal host image index\")) { /* delete cached image and re-pull */ } throw e }","preventionTips":["Watch for disk corruption; run fs checks on the engine's data volume.","Avoid third-party tools writing into the Dagger content store.","Verify registry mirrors serve untruncated blobs."],"tags":["oci","json","corruption","image-index"],"backgroundTag":"oci-manifest-corrupt","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"}