{"record":{"id":"c448e4cbd0c57eec","repo":"jdx/mise","slug":"mise-cannot-derive-completions-from-a-format-spe","errorCode":null,"errorMessage":"mise cannot derive completions from a {format} spec","messagePattern":"mise cannot derive completions from a (.+?) spec","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/packslip.rs","lineNumber":1099,"sourceCode":"        .envs(env)\n        .prepend_path(vec![install_path.join(MISE_BINS_DIR)])?\n        .current_dir(work.path())\n        .stdin(std::process::Stdio::null())\n        .stderr(std::process::Stdio::null())\n        .with_timeout(timeout)\n        .read_isolated(4 * 1024 * 1024)\n        .await?;\n    if output.trim().is_empty() {\n        bail!(\"resource command produced no output\");\n    }\n    Ok(output)\n}\n\n/// Derive a completion script from a CLI spec with the consumer's own\n/// tooling. Only the `usage` format is known.\nfn derive_from_spec(format: &str, bin: &str, spec: &Path, shell: &str) -> Result<String> {\n    if format != \"usage\" {\n        bail!(\"mise cannot derive completions from a {format} spec\");\n    }\n    // Validate before returning a loader, so an invalid preferred spec still\n    // falls through to another resource source.\n    file::read_to_string(spec)?\n        .parse::<usage::Spec>()\n        .map_err(|err| eyre!(\"invalid usage specification: {err}\"))?;\n    let shell = usage_rs::complete::Shell::from_name(shell)\n        .ok_or_else(|| eyre!(\"unsupported completion shell: {shell}\"))?;\n    let path = completions::encode_spec_path(spec);\n    let script = usage_rs::script::script_for(\"mise\", bin, shell);\n    Ok(script.replace(\n        \" __complete_word__ \",\n        &format!(\" __usage_complete_word {path} \"),\n    ))\n}\n\n/// The `shell` completion script for `tool`, from the packslip of the\n/// version that is active right now.","sourceCodeStart":1081,"sourceCodeEnd":1117,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/packslip.rs#L1081-L1117","documentation":"mise can only auto-derive a shell completion script from a CLI specification in the `usage` format, because it shells out to usage's own completion tooling. When a packslip's cli-spec resource names any other format (e.g. clap_complete, cobra, custom JSON), derive_from_spec refuses to guess how to turn it into a completion script and bails. The error is collected per-source and usually surfaces wrapped inside the 'no usable <shell> completion' aggregate error.","triggerScenarios":"Calling `mise completion <shell> --tool <tool>` (or tab-completing a tool) where the tool's packslip declares a cli-spec completion source whose format string is anything other than \"usage\".","commonSituations":"Installing a tool via a packslip whose publisher generates specs in another format; a mis-authored packslip where the format field was typoed (e.g. \"usge\" or \"clap\"); a vendor switching spec formats between releases.","solutions":["Check the tool's packslip statement for its cli-spec format; if it is not \"usage\", the source cannot be used by mise and another completion source (file or exec) must be declared.","If you author the packslip, change the format field to \"usage\" or add a separate completion file/exec source.","Run `mise completion <shell> --tool <tool>` again after fixing the packslip and reinstalling; verify with `mise packslip forget <project>` and reinstall if the statement is stale."],"exampleFix":"// packslip statement — before\n[[resource]]\ntype = \"cli-spec\"\nformat = \"clap_complete\"\n// after\n[[resource]]\ntype = \"cli-spec\"\nformat = \"usage\"","handlingStrategy":"fallback","validationCode":"let format = packslip_cli_spec_format(tool); // from statement\nif format != Some(\"usage\") { eprintln!(\"cli-spec source unusable; expect fallback source\"); }","typeGuard":"fn is_usage_spec(format: &str) -> bool { format == \"usage\" }","tryCatchPattern":"match completion_script(&config, tool, shell) {\n    Ok(script) => use(script),\n    Err(e) if e.to_string().contains(\"cannot derive completions\") => try_next_source(),\n    Err(e) => return Err(e),\n}","preventionTips":["Only rely on cli-spec completions for tools publishing usage-format specs.","Prefer packslips that also declare static completion files or exec sources as fallback.","Check the packslip statement's cli-spec format field before expecting derived completions."],"tags":["completions","packslip","unsupported-format"],"backgroundTag":"unsupported-operation","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"}