{"record":{"id":"3d87304ea42588ac","repo":"dagger/dagger","slug":"no-media-type-is-stored-for-q","errorCode":null,"errorMessage":"no media type is stored for %q","messagePattern":"no media type is stored for %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/snapshots/refs.go","lineNumber":545,"sourceCode":"\t\t}\n\t\tif isContinue, err := walkBlobVariantsOnly(ctx, cs, c, f, visited); !isContinue || err != nil {\n\t\t\treturn isContinue, err\n\t\t}\n\t}\n\treturn true, nil\n}\n\nfunc getBlobDesc(ctx context.Context, cs content.Store, dgst digest.Digest) (ocispecs.Descriptor, error) {\n\tinfo, err := cs.Info(ctx, dgst)\n\tif err != nil {\n\t\treturn ocispecs.Descriptor{}, err\n\t}\n\tif info.Labels == nil {\n\t\treturn ocispecs.Descriptor{}, errors.Errorf(\"no blob metadata is stored for %q\", info.Digest)\n\t}\n\tmt, ok := info.Labels[blobMediaTypeLabel]\n\tif !ok {\n\t\treturn ocispecs.Descriptor{}, errors.Errorf(\"no media type is stored for %q\", info.Digest)\n\t}\n\tdesc := ocispecs.Descriptor{\n\t\tDigest:    info.Digest,\n\t\tSize:      info.Size,\n\t\tMediaType: mt,\n\t}\n\tfor k, v := range info.Labels {\n\t\tif strings.HasPrefix(k, blobAnnotationsLabelPrefix) {\n\t\t\tif desc.Annotations == nil {\n\t\t\t\tdesc.Annotations = make(map[string]string)\n\t\t\t}\n\t\t\tdesc.Annotations[strings.TrimPrefix(k, blobAnnotationsLabelPrefix)] = v\n\t\t}\n\t}\n\tif len(desc.URLs) == 0 {\n\t\t// If there are no URL's, there is no reason to have this be non-dsitributable\n\t\tdesc.MediaType = layerToDistributable(desc.MediaType)\n\t}","sourceCodeStart":527,"sourceCodeEnd":563,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/engine/snapshots/refs.go#L527-L563","documentation":"getBlobDesc reconstructs an OCI descriptor from a blob's content-store metadata. The blob's media type is stored as a label (blobMediaTypeLabel) on the content record; if the record exists but lacks that label, the media type cannot be recovered and this error is thrown. It indicates the blob was stored without full descriptor metadata, typically by older versions or by paths that wrote blobs directly.","triggerScenarios":"Calling getBlobDesc (via ociDesc or walkBlobVariantsOnly) on a content-store blob whose Info.Labels map exists but has no blobMediaTypeLabel key — e.g. blobs ingested by a containerd/dagger version that did not stamp media-type labels, or GC-rebuilt metadata.","commonSituations":"Upgrading from an older engine whose stored blobs predate the blobMediaTypeLabel convention; inspecting/exporting caches created by another tool that populated the content store directly.","solutions":["Re-push or re-ingest the affected blob so addBlobDescToInfo writes the media-type label","Run a migration/GC-prune of the content store to drop legacy unlabeled blobs","Skip blobs missing the label in walkBlobVariantsOnly rather than failing the whole walk"],"exampleFix":"// before\ndesc, err := getBlobDesc(ctx, cs, dgst) // errors on unlabeled blob\n// after\nif _, err := cs.Info(ctx, dgst); err == nil {\n    info, _ := cs.Info(ctx, dgst)\n    if info.Labels == nil || info.Labels[blobMediaTypeLabel] == \"\" {\n        info = addBlobDescToDesc(desc, info) // backfill label before querying\n        cs.Update(ctx, info, \"labels.\"+blobMediaTypeLabel)\n    }\n}\ndesc, err := getBlobDesc(ctx, cs, dgst)","handlingStrategy":"type-guard","validationCode":"info, err := cs.Info(ctx, dgst)\nif err != nil { return err }\nif info.Labels == nil || info.Labels[blobMediaTypeLabel] == \"\" {\n    // legacy/unlabeled blob: backfill or skip\n    info = addBlobDescToInfo(desc, info)\n    if _, err := cs.Update(ctx, info, \"labels.\"+blobMediaTypeLabel); err != nil { return err }\n}","typeGuard":"func hasBlobMediaType(info content.Info) bool {\n    return info.Labels != nil && info.Labels[blobMediaTypeLabel] != \"\"\n}","tryCatchPattern":"desc, err := getBlobDesc(ctx, cs, dgst)\nif err != nil && strings.Contains(err.Error(), \"no media type is stored\") {\n    // fall back to default layer media type or skip variant\n}","preventionTips":["Always write blobs through paths that call addBlobDescToInfo","After engine upgrades, run a migration over stored blobs to add missing labels","In walker code, skip-not-fail on unlabeled variants"],"tags":["oci","content-store","metadata"],"backgroundTag":"missing-blob-media-type-label","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"}