{"record":{"id":"3d9f71252b72b8c6","repo":"jdx/mise","slug":"image-dir-display-expected-exactly-one-manifest","errorCode":null,"errorMessage":"{image_dir.display}: expected exactly one manifest in index.json","messagePattern":"(.+?): expected exactly one manifest in index\\.json","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/oci/docker_archive.rs","lineNumber":46,"sourceCode":"    #[serde(rename = \"Config\")]\n    config: String,\n    #[serde(rename = \"RepoTags\")]\n    repo_tags: Vec<String>,\n    #[serde(rename = \"Layers\")]\n    layers: Vec<String>,\n}\n\n/// Stream the OCI layout at `image_dir` into `docker load`, tagging the\n/// loaded image as `tag`.\npub(crate) fn load_into_docker(image_dir: &Path, tag: &str) -> Result<()> {\n    let layout = ImageLayout {\n        root: image_dir.to_path_buf(),\n    };\n    let index_bytes = crate::file::read(image_dir.join(\"index.json\"))?;\n    let index: ImageIndex = serde_json::from_slice(&index_bytes).wrap_err(\"parsing index.json\")?;\n    let manifest_desc = match index.manifests.as_slice() {\n        [one] => one,\n        _ => bail!(\n            \"{}: expected exactly one manifest in index.json\",\n            image_dir.display()\n        ),\n    };\n    let manifest_bytes = layout.read_blob(&manifest_desc.digest)?;\n    let manifest: ImageManifest =\n        serde_json::from_slice(&manifest_bytes).wrap_err(\"parsing image manifest blob\")?;\n    let config_bytes = layout.read_blob(&manifest.config.digest)?;\n\n    // Validate every layer digest before it's used as a path component in\n    // `write_docker_archive` (which reads via `blob_path`, bypassing the\n    // check `read_blob` performs) — a crafted `--image-dir` layout could\n    // otherwise escape the blobs directory with `sha256:../…`.\n    for layer in &manifest.layers {\n        crate::oci::layout::validate_sha256_digest(&layer.digest)?;\n    }\n\n    let mut command = Command::new(\"docker\");","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/oci/docker_archive.rs#L28-L64","documentation":"When loading an OCI image layout into docker, load_into_docker reads index.json and expects exactly one manifest entry. This error is thrown when the OCI image index contains zero or multiple manifests, since the loader cannot decide which manifest to load and does not implement multi-manifest (multi-arch/attestation) selection.","triggerScenarios":"Pointing load_into_docker (via `mise oci load` or similar) at an image directory whose index.json has 0 or >=2 entries in the `manifests` array — e.g. a multi-arch index produced by buildx, or a truncated/incorrectly generated layout.","commonSituations":"Building with docker buildx producing a manifest list instead of a single-platform image; hand-editing or regenerating index.json and leaving stale manifest descriptors; concatenating or exporting images with attestation manifests.","solutions":["Rebuild/export the image for a single platform (e.g. `docker buildx build --platform linux/amd64` with `--provenance=false --sbom=false`) so index.json has exactly one manifest.","Inspect index.json in image_dir and remove extra manifest descriptors, keeping only the one for your platform.","Regenerate the OCI layout with the same mise tool that produced it originally rather than hand-modifying index.json."],"exampleFix":"// before (index.json with 2 manifests from buildx attestation)\n// docker buildx build --platform linux/amd64,linux/arm64 -o type=oci,dest=img.tar\n// after\ndocker buildx build --platform linux/amd64 --provenance=false --sbom=false -o type=oci,dest=img.tar","handlingStrategy":"validation","validationCode":"const index = JSON.parse(fs.readFileSync(path.join(imageDir, \"index.json\")));\nif (index.manifests.length !== 1) {\n  throw new Error(`need exactly 1 manifest, found ${index.manifests.length}; rebuild single-platform`);\n}","typeGuard":null,"tryCatchPattern":"match load_into_docker(&image_dir) {\n    Err(e) if e.to_string().contains(\"expected exactly one manifest\") => {\n        eprintln!(\"rebuild single-platform (no attestation manifests) and retry\");\n    }\n    r => r,\n}","preventionTips":["Build single-platform OCI exports; disable provenance/SBOM attestations with buildx.","Do not hand-edit index.json.","Verify manifest count before calling load."],"tags":["oci","docker","image-index"],"backgroundTag":"unexpected-response-shape","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}