{"record":{"id":"98f29c4d480c4f1c","repo":"slimtoolkit/slim","slug":"unexpected-media-type-for-index","errorCode":null,"errorMessage":"unexpected media type for index","messagePattern":"unexpected media type for index","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/app/master/command/registry/handler_image_index.go","lineNumber":186,"sourceCode":"\t\t\t\t\t\"exit.code\": exitCode,\n\t\t\t\t\t\"version\":   v.Current(),\n\t\t\t\t})\n\t\t\txc.Exit(exitCode)\n\t\t} else {\n\t\t\txc.FailOn(fmt.Errorf(\"saving image index error - %s (%v)\", cparams.ImageIndexName, err))\n\t\t}\n\t}\n\n\tindexMeta, err := remote.Index(imageIndexRef, remoteOpts...)\n\tif err != nil {\n\t\txc.FailOn(fmt.Errorf(\"index reference metadata get error - %s (%v)\", cparams.ImageIndexName, err))\n\t}\n\n\tindexMediaType, err := indexMeta.MediaType()\n\txc.FailOn(err)\n\n\tif !indexMediaType.IsIndex() {\n\t\txc.FailOn(fmt.Errorf(\"unexpected media type for index\"))\n\t}\n\n\tindexDigest, err := indexMeta.Digest()\n\txc.FailOn(err)\n\n\tindexManifest, err := indexMeta.IndexManifest()\n\txc.FailOn(err)\n\txc.Out.Info(\"index.info\",\n\t\tovars{\n\t\t\t\"reference\":                imageIndexRef,\n\t\t\t\"digest\":                   indexDigest.String(),\n\t\t\t\"manifest.schema\":          indexManifest.SchemaVersion,\n\t\t\t\"manifest.media_type\":      indexManifest.MediaType,\n\t\t\t\"manifest.image.ref.count\": len(indexManifest.Manifests),\n\t\t})\n\n\tif cparams.DumpRawManifest {\n\t\tif rm, err := indexMeta.RawManifest(); err == nil {","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/slimtoolkit/slim/blob/81940d17fa112cc678e32209214bcb2355cb3004/pkg/app/master/command/registry/handler_image_index.go#L168-L204","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nImageIndexName: \"registry.example.com/app:v1\" // tag also used for amd64 image\n// after\nImageIndexName: \"registry.example.com/app:v1\" // ensure only the index is pushed to this tag; use v1-amd64 for the single arch","handlingStrategy":"type-guard","validationCode":"desc, err := remote.Head(ref)\nif err == nil && !desc.MediaType.IsIndex() {\n    return fmt.Errorf(\"%s is not an index (media type %s)\", ref.Name(), desc.MediaType)\n}","typeGuard":"func isIndexMediaType(mt types.MediaType) bool {\n    return mt == types.OCIImageIndex || mt == types.DockerManifestList\n}","tryCatchPattern":null,"preventionTips":["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"],"tags":["media-type","image-index","validation"],"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"}