dagger/dagger · error
unmarshal host image index: %w
Error message
unmarshal host image index: %w
What it means
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.
Source
Thrown at core/schema/host.go:729
switch desc.MediaType {
case ocispec.MediaTypeImageManifest, images.MediaTypeDockerSchema2Manifest:
if _, err := store.Info(ctx, desc.Digest); err != nil {
if cerrdefs.IsNotFound(err) {
return nil, true, nil
}
return nil, false, fmt.Errorf("stat host manifest %s: %w", desc.Digest, err)
}
return &desc, true, nil
case ocispec.MediaTypeImageIndex, images.MediaTypeDockerSchema2ManifestList:
indexBlob, err := content.ReadBlob(ctx, store, desc)
if err != nil {
return nil, false, fmt.Errorf("read host image index blob: %w", err)
}
var idx ocispec.Index
if err := json.Unmarshal(indexBlob, &idx); err != nil {
return nil, false, fmt.Errorf("unmarshal host image index: %w", err)
}
matched := false
for _, manifest := range idx.Manifests {
switch manifest.MediaType {
case ocispec.MediaTypeImageManifest, images.MediaTypeDockerSchema2Manifest,
ocispec.MediaTypeImageIndex, images.MediaTypeDockerSchema2ManifestList:
default:
continue
}
if manifest.Platform != nil && !matcher.Match(*manifest.Platform) {
continue
}
target, childMatched, err := resolveHostStoreManifestMatch(ctx, store, manifest, matcher)
if err != nil {
return nil, false, err
}
matched = matched || childMatchedView on GitHub (pinned to 82ba2681db)
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.
Defensive patterns
Strategy: retry
Try / catch
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 } Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Disk corruption or interrupted writes to the content store; blobs produced/tampered with by third-party tools; unusual media types with non-index payloads.
Related errors
- unmarshal index: %w
- expected index, got %s
- expected manifest or index, got %s
- no manifest for platform %s and tag %s
- read host image index blob: %w
AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05).
Data as JSON: /api/errors/ffd30e02740bf8e6.
Report an issue: GitHub.