{"record":{"id":"4332a8dce9512c2d","repo":"jdx/mise","slug":"does-not-look-like-an-oci-image-layout-missin-4332a8","errorCode":null,"errorMessage":"{}: does not look like an OCI image layout (missing index.json)","messagePattern":"(.+?): does not look like an OCI image layout \\(missing index\\.json\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/oci/run.rs","lineNumber":115,"sourceCode":"    cmd: Vec<String>,\n}\n\n#[derive(Debug, Clone, Copy, PartialEq, clap::ValueEnum)]\nenum Engine {\n    Auto,\n    Podman,\n    Docker,\n}\n\nimpl Run {\n    pub async fn run(self) -> Result<()> {\n        Settings::get().ensure_experimental(\"mise oci run\")?;\n\n        // 1. Validate arguments first so bad args win over \"engine missing\".\n        if let Some(d) = &self.image_dir\n            && !d.join(\"index.json\").is_file()\n        {\n            bail!(\n                \"{}: does not look like an OCI image layout (missing index.json)\",\n                d.display()\n            );\n        }\n\n        // 2. Locate a container engine.\n        let engine = select_engine(self.engine)?;\n\n        // 3. Build (or reuse an existing layout). When building, keep the\n        // `TempDir` alive for the duration of the command — it removes the\n        // directory on drop, so partial-gigabyte tool layers don't pile up\n        // in /tmp across invocations.\n        let (image_dir, _tempdir_guard): (PathBuf, Option<TempDir>) =\n            if let Some(d) = &self.image_dir {\n                (d.clone(), None)\n            } else {\n                let td = TempDir::with_prefix(\"mise-oci-run-\")\n                    .wrap_err(\"creating temp dir for oci build output\")?;","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/cli/oci/run.rs#L97-L133","documentation":"`mise oci run --image-dir <d>` requires `d` to be a valid OCI image layout (one containing `index.json` at its root, as produced by `mise oci build`). This check runs FIRST — before container-engine detection — deliberately so a bad argument wins over the 'engine missing' error and you get the most specific message.","triggerScenarios":"`mise oci run --image-dir ./out ...` where ./out lacks index.json: empty directory, parent of the real layout, leftover partial output, or a path pointing at a tarball's containing folder instead of the extracted layout.","commonSituations":"Reusing a CI artifact directory whose layout files were stripped; passing the build's temp-dir root instead of its `image` subdirectory; typos in the path so a different (layout-less) directory is found.","solutions":["Generate the layout first: `mise oci build -o ./image ...` then `mise oci run --image-dir ./image ...`","Confirm the marker: `test -f ./out/index.json`","Re-extract the artifact if index.json was lost in transit"],"exampleFix":"# before\nmise oci run --image-dir ./out -- bash\n# after\nmise oci build -o ./out && mise oci run --image-dir ./out -- bash","handlingStrategy":"validation","validationCode":"# bash: validate before oci run\nif [ -n \"$IMAGE_DIR\" ] && [ ! -f \"$IMAGE_DIR/index.json\" ]; then\n  echo \"invalid OCI layout: $IMAGE_DIR\" >&2; exit 2\nfi\nmise oci run ${IMAGE_DIR:+--image-dir \"$IMAGE_DIR\"} -- bash","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Assert `test -f <dir>/index.json` right after producing/extracting any layout artifact","Keep the check before engine selection in wrappers so you get the arg-level error, not an engine error"],"tags":["oci","run","image-layout","filesystem"],"backgroundTag":"invalid-oci-image-layout","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}