{"record":{"id":"d120b24ff538a95d","repo":"slimtoolkit/slim","slug":"unexpected-target-image-type-s-v","errorCode":null,"errorMessage":"unexpected target image type - %s (%v)","messagePattern":"unexpected target image type - (.+?) \\((.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/app/master/command/registry/handler_image_index.go","lineNumber":147,"sourceCode":"\n\t\t\tbasicImageInfo(xc, imgMeta)\n\n\t\t\timgConfig, err := imgMeta.ConfigFile()\n\t\t\tif err != nil {\n\t\t\t\txc.FailOn(err)\n\t\t\t}\n\t\t\timgRefMeta, err := partial.Descriptor(imgMeta)\n\t\t\tif err != nil {\n\t\t\t\txc.FailOn(err)\n\t\t\t}\n\t\t\timgRefMeta.Platform = imgConfig.Platform()\n\t\t\tindexImageImgRefs = append(indexImageImgRefs,\n\t\t\t\tmutate.IndexAddendum{\n\t\t\t\t\tAdd:        imgMeta,\n\t\t\t\t\tDescriptor: *imgRefMeta,\n\t\t\t\t})\n\t\t} else {\n\t\t\txc.FailOn(fmt.Errorf(\"unexpected target image type - %s (%v)\", imageName, meta.MediaType))\n\t\t}\n\t}\n\n\tif cparams.AsManifestList {\n\t\timageIndex = mutate.IndexMediaType(imageIndex, types.DockerManifestList)\n\t}\n\n\timageIndex = mutate.AppendManifests(imageIndex, indexImageImgRefs...)\n\n\tif err := remote.WriteIndex(imageIndexRef, imageIndex, remoteOpts...); err != nil {\n\t\tvar terr *transport.Error\n\t\tif errors.As(err, &terr) && terr.StatusCode == http.StatusUnauthorized {\n\t\t\txc.Out.Info(\"registry.auth.error\",\n\t\t\t\tovars{\n\t\t\t\t\t\"message\": \"need to authenticate\",\n\t\t\t\t})\n\n\t\t\texitCode := -111","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/slimtoolkit/slim/blob/81940d17fa112cc678e32209214bcb2355cb3004/pkg/app/master/command/registry/handler_image_index.go#L129-L165","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nImageNames: []string{\"registry.example.com/app:v1\"} // v1 is already a manifest list\n// after\nImageNames: []string{\"registry.example.com/app:v1-amd64\", \"registry.example.com/app:v1-arm64\"}","handlingStrategy":"type-guard","validationCode":"desc, err := remote.Head(ref)\nif err == nil && !desc.MediaType.IsImage() {\n    return fmt.Errorf(\"%s is %s, expected an image manifest\", ref.Name(), desc.MediaType)\n}","typeGuard":"func isPlainImage(mtypes types.MediaType) bool {\n    return mtypes == types.DockerManifestSchema2 || mtypes == types.OCIManifestSchema1\n}","tryCatchPattern":null,"preventionTips":["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"],"tags":["validation","media-type","image-index"],"backgroundTag":"unexpected-manifest-media-type","analyzedSha":"81940d17fa112cc678e32209214bcb2355cb3004","analyzedAt":"2026-08-31T23:06:12.682Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}