{"record":{"id":"3d31c7356f06da75","repo":"jdx/mise","slug":"no-executable-files-found-in-archive","errorCode":null,"errorMessage":"No executable files found in archive","messagePattern":"No executable files found in archive","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/generate/tool_stub.rs","lineNumber":634,"sourceCode":"        file::extract_archive(\n            archive_path,\n            &extracted_dir,\n            format,\n            &file::ExtractOptions {\n                pr: Some(pr),\n                ..Default::default()\n            },\n        )?;\n\n        // Check if strip_components would be applied during actual installation\n        let format =\n            ExtractionFormat::from_file_name(&archive_path.file_name().unwrap().to_string_lossy());\n        let will_strip = file::should_strip_components(archive_path, format)?;\n\n        // Find executable files\n        let executables = self.find_executables(&extracted_dir)?;\n        if executables.is_empty() {\n            bail!(\"No executable files found in archive\");\n        }\n\n        // Look for exact filename match only\n        let tool_name = self.get_tool_name();\n        let selected_exe = self.find_exact_binary_match(&executables, &tool_name)?;\n\n        // If strip_components will be applied, remove the first path component\n        if will_strip {\n            let path = std::path::Path::new(&selected_exe);\n            if let Ok(stripped) = path.strip_prefix(path.components().next().unwrap()) {\n                let stripped_str = stripped.to_string_lossy().to_string();\n                // Don't return empty string if stripping removed everything\n                if !stripped_str.is_empty() {\n                    return Ok(stripped_str);\n                }\n            }\n        }\n","sourceCodeStart":616,"sourceCodeEnd":652,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/cli/generate/tool_stub.rs#L616-L652","documentation":"During stub generation mise downloads and extracts the archive, then scans it for executable files to pick the binary path. If find_executables returns nothing (no file with an executable bit), generation stops because the stub needs a `bin` path to run. Note this is checked before auto-selection, so it fires even before find_exact_binary_match runs.","triggerScenarios":"Archives containing only non-executable files (README, LICENSE, .so libraries); archives where the executable bit was lost (e.g. re-packed on Windows, or zips where permissions are not stored); archives that contain only a directory of sources.","commonSituations":"Windows-built zip artifacts where no exec bit survives; users testing the generator against source tarballs instead of release binaries.","solutions":["Point --url at a release archive that actually contains a runnable binary with its executable bit set","Pre-download the archive, mark the binary executable (chmod +x), repack, and regenerate","Skip analysis with --skip-download and supply the binary path explicitly via --bin (and/or --platform-bin)"],"exampleFix":"# before\nmise generate tool-stub ./ctl --url https://example.com/ctl-1.0.0-src.tar.gz\n# after\nmise generate tool-stub ./ctl --url https://example.com/ctl-1.0.0-linux-x64.tar.gz --skip-download --bin bin/ctl","handlingStrategy":"fallback","validationCode":"#!/usr/bin/env bash\n# verify the archive actually contains an executable before generating\ncurl -fsSL \"$url\" -o /tmp/a.tar.gz\ntar -tzf /tmp/a.tar.gz | grep -qE '(^|/)[^/]+$' || { echo 'archive has no candidate files' >&2; exit 2; }\nmise generate tool-stub ./out --url \"$url\"","typeGuard":null,"tryCatchPattern":"if ! mise generate tool-stub ./out --url \"$url\" 2>err.log; then grep -q 'No executable files found' err.log && mise generate tool-stub ./out --url \"$url\" --skip-download --bin \"${BIN_PATH:?set BIN_PATH}\"; fi","preventionTips":["Keep the executable bit set when repacking archives (tar preserves it; zip does not)","Have a --bin fallback ready in automation for artifacts with no exec bits"],"tags":["cli","tool-stub","archive","executable-permissions","mise"],"backgroundTag":"no-executables-in-archive","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}