{"record":{"id":"1505a26f66a66ed8","repo":"jdx/mise","slug":"could-not-determine-which-executable-to-use-for","errorCode":null,"errorMessage":"Could not determine which executable to use for '{}'. Available executables:\n  {}\n\nUse --bin to specify the correct binary path.","messagePattern":"Could not determine which executable to use for '(.+?)'\\. Available executables:\n  (.+?)\n\nUse --bin to specify the correct binary path\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/generate/tool_stub.rs","lineNumber":746,"sourceCode":"                    .unwrap_or(false)\n            })\n            .collect();\n\n        // If there's exactly one match containing the tool name, use it\n        if name_matches.len() == 1 {\n            return Ok(name_matches[0].clone());\n        }\n\n        // Strategy 3: If there's only one executable total, use it\n        if executables.len() == 1 {\n            return Ok(executables[0].clone());\n        }\n\n        // No good match found, provide helpful error message\n        let mut exe_list = executables.to_vec();\n        exe_list.sort();\n\n        bail!(\n            \"Could not determine which executable to use for '{}'. Available executables:\\n  {}\\n\\nUse --bin to specify the correct binary path.\",\n            tool_name,\n            exe_list.join(\"\\n  \")\n        );\n    }\n\n    async fn lock_stub(&self) -> Result<String> {\n        if !self.output.exists() {\n            bail!(\n                \"Tool stub file does not exist: {}\",\n                display_path(&self.output)\n            );\n        }\n\n        let mut stub = ToolStubFile::from_file(&self.output)?;\n        let config = Config::get().await?;\n\n        // Allow --version to override the version in the stub for bumping","sourceCodeStart":728,"sourceCodeEnd":764,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/cli/generate/tool_stub.rs#L728-L764","documentation":"After downloading and extracting, mise found multiple executable files and none of the heuristics produced a winner (no exact filename match for the stub's tool name, no unique name-stem match, more than one executable overall). It lists the sorted candidates and asks you to disambiguate with --bin.","triggerScenarios":"Archives shipping several executables (e.g. `ctl`, `ctl-gen`, `ctl-completion`, wrappers) where the output file name doesn't exactly match the intended binary; monorepo release archives bundling many tools; output stub named generically (`tool`) so the exact-match heuristic can't identify the right one.","commonSituations":"Generating a stub for gorelester-style archives that include completion scripts and helpers alongside the main binary; naming the output file something other than the binary name.","solutions":["Pick the right path from the listed candidates and pass it: `--bin bin/ctl` (paths are relative to the extracted archive root, after strip-components)","Name the output file exactly like the binary so the exact-filename heuristic matches (e.g. `mise generate tool-stub ./ctl ...`)","Use --platform-bin for archives whose binary layout differs per platform"],"exampleFix":"# before\nmise generate tool-stub ./tool --url https://.../bundle.tar.gz\n# error lists: ctl, ctl-gen, completions/ctl.bash\n# after\nmise generate tool-stub ./ctl --bin ctl --url https://.../bundle.tar.gz","handlingStrategy":"fallback","validationCode":"#!/usr/bin/env bash\n# name the output file exactly after the binary to help the exact-match heuristic\nmise generate tool-stub \"./$(basename \"$BIN_PATH\")\" --url \"$url\"","typeGuard":null,"tryCatchPattern":"if ! mise generate tool-stub ./out --url \"$url\" 2>err.log; then grep -q 'Could not determine which executable' err.log && mise generate tool-stub ./out --url \"$url\" --bin \"$BIN_PATH\"; fi","preventionTips":["Name the stub file after the binary it wraps","In automation, always pass --bin (or --platform-bin) when the archive ships multiple executables"],"tags":["cli","tool-stub","ambiguous-binary","archive","mise"],"backgroundTag":"ambiguous-binary-selection","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}