slimtoolkit/slim · error
unexpected media type for index
Error message
unexpected media type for index
What it means
The fetched descriptor for the index reference is not actually an index: indexMeta.MediaType().IsIndex() returned false. The remote object exists but is a single image manifest (or other type), so treating it as an image index would be invalid and the handler aborts.
Source
Thrown at pkg/app/master/command/registry/handler_image_index.go:186
"exit.code": exitCode,
"version": v.Current(),
})
xc.Exit(exitCode)
} else {
xc.FailOn(fmt.Errorf("saving image index error - %s (%v)", cparams.ImageIndexName, err))
}
}
indexMeta, err := remote.Index(imageIndexRef, remoteOpts...)
if err != nil {
xc.FailOn(fmt.Errorf("index reference metadata get error - %s (%v)", cparams.ImageIndexName, err))
}
indexMediaType, err := indexMeta.MediaType()
xc.FailOn(err)
if !indexMediaType.IsIndex() {
xc.FailOn(fmt.Errorf("unexpected media type for index"))
}
indexDigest, err := indexMeta.Digest()
xc.FailOn(err)
indexManifest, err := indexMeta.IndexManifest()
xc.FailOn(err)
xc.Out.Info("index.info",
ovars{
"reference": imageIndexRef,
"digest": indexDigest.String(),
"manifest.schema": indexManifest.SchemaVersion,
"manifest.media_type": indexManifest.MediaType,
"manifest.image.ref.count": len(indexManifest.Manifests),
})
if cparams.DumpRawManifest {
if rm, err := indexMeta.RawManifest(); err == nil {View on GitHub (pinned to 81940d17fa)
Solutions
- Push the assembled index to a dedicated tag and verify that tag
- Re-run the index create so the index overwrites the colliding image tag
- Confirm the remote type with 'docker manifest inspect <ref>' (look for manifests list vs single manifest)
- Use distinct tags/names for single-arch images vs the multi-arch index
Example fix
// before ImageIndexName: "registry.example.com/app:v1" // tag also used for amd64 image // after ImageIndexName: "registry.example.com/app:v1" // ensure only the index is pushed to this tag; use v1-amd64 for the single arch
Defensive patterns
Strategy: type-guard
Validate before calling
desc, err := remote.Head(ref)
if err == nil && !desc.MediaType.IsIndex() {
return fmt.Errorf("%s is not an index (media type %s)", ref.Name(), desc.MediaType)
} Type guard
func isIndexMediaType(mt types.MediaType) bool {
return mt == types.OCIImageIndex || mt == types.DockerManifestList
} Prevention
- Push the index to a tag not used by single-arch images
- Use distinct tags for single-arch images vs the multi-arch index
- Inspect the remote type with docker manifest inspect before verification
When it happens
Trigger: The tag pointed to by ImageIndexName resolves to a plain image manifest instead of a manifest list/OCI index — typically because a single-platform image was pushed to the same tag, or the wrong tag name was given for verification.
Common situations: Tag collision where a later single-arch push overwrote the index tag; verifying against a stale tag; registries that rewrite media types; user confusing image tag with index tag.
Related errors
- unexpected target image type - %s (%v)
- no image references for image index
- podPort cannot be empty
- file path is not absolute
- file is not a binary
AI-assisted analysis of slimtoolkit/slim@81940d17fa (2026-08-31).
Data as JSON: /api/errors/98f29c4d480c4f1c.
Report an issue: GitHub.