slimtoolkit/slim · error
unexpected target image type - %s (%v)
Error message
unexpected target image type - %s (%v)
What it means
After fetching metadata, the handler expects each referenced object to be a plain image (meta.MediaType.IsImage()). If the descriptor is some other type — e.g. an index/manifest list or an unknown artifact — it fails with this error naming the image and its media type.
Source
Thrown at pkg/app/master/command/registry/handler_image_index.go:147
basicImageInfo(xc, imgMeta)
imgConfig, err := imgMeta.ConfigFile()
if err != nil {
xc.FailOn(err)
}
imgRefMeta, err := partial.Descriptor(imgMeta)
if err != nil {
xc.FailOn(err)
}
imgRefMeta.Platform = imgConfig.Platform()
indexImageImgRefs = append(indexImageImgRefs,
mutate.IndexAddendum{
Add: imgMeta,
Descriptor: *imgRefMeta,
})
} else {
xc.FailOn(fmt.Errorf("unexpected target image type - %s (%v)", imageName, meta.MediaType))
}
}
if cparams.AsManifestList {
imageIndex = mutate.IndexMediaType(imageIndex, types.DockerManifestList)
}
imageIndex = mutate.AppendManifests(imageIndex, indexImageImgRefs...)
if err := remote.WriteIndex(imageIndexRef, imageIndex, remoteOpts...); err != nil {
var terr *transport.Error
if errors.As(err, &terr) && terr.StatusCode == http.StatusUnauthorized {
xc.Out.Info("registry.auth.error",
ovars{
"message": "need to authenticate",
})
exitCode := -111View on GitHub (pinned to 81940d17fa)
Solutions
- Reference individual single-platform image tags, not existing manifest lists
- If you need to nest, flatten the existing index into its child image digests first
- Check the media type with 'docker manifest inspect <ref>' before adding it
- Skip or handle non-image artifacts separately
Example fix
// before
ImageNames: []string{"registry.example.com/app:v1"} // v1 is already a manifest list
// after
ImageNames: []string{"registry.example.com/app:v1-amd64", "registry.example.com/app:v1-arm64"} Defensive patterns
Strategy: type-guard
Validate before calling
desc, err := remote.Head(ref)
if err == nil && !desc.MediaType.IsImage() {
return fmt.Errorf("%s is %s, expected an image manifest", ref.Name(), desc.MediaType)
} Type guard
func isPlainImage(mtypes types.MediaType) bool {
return mtypes == types.DockerManifestSchema2 || mtypes == types.OCIManifestSchema1
} Prevention
- Only pass single-platform image tags to index create
- Flatten nested manifest lists into child digests before adding
- Inspect media types with docker manifest inspect beforehand
When it happens
Trigger: Passing an already-multi-arch manifest list or an OCI index (or a non-image artifact like an attestation blob) as one of the ImageNames entries; media type not recognized as an image manifest.
Common situations: Nesting indexes (index-of-index) which this code path doesn't support; referencing sboms/signatures/attestation manifests by mistake; registry returning unusual media types for older Docker schema images.
Related errors
- unexpected media type for index
- 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/d120b24ff538a95d.
Report an issue: GitHub.