{"record":{"id":"7f016e8d6c288fad","repo":"jdx/mise","slug":"resource-command-produced-no-output","errorCode":null,"errorMessage":"resource command produced no output","messagePattern":"resource command produced no output","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/packslip.rs","lineNumber":1090,"sourceCode":"    path: &Path,\n    args: &[String],\n    env: &BTreeMap<String, String>,\n    install_path: &Path,\n    timeout: std::time::Duration,\n) -> Result<String> {\n    let work = tempfile::tempdir()?;\n    let output = CmdLineRunner::new(path)\n        .args(args)\n        .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);","sourceCodeStart":1072,"sourceCodeEnd":1108,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/packslip.rs#L1072-L1108","documentation":"run_resource_command runs the tool's command in isolation (null stdin/stderr, timeout, 4MB read cap) and returns its stdout. If the captured output trims to empty, it bails, because consumers (like completion script derivation) require non-empty output. This treats silent commands as failures since there is nothing to use downstream.","triggerScenarios":"An exec/resource command that writes nothing to stdout — e.g. a completion command that prints to stderr, a command whose output exceeded the 4MB read cap leaving nothing usable, or a command that failed silently — invoked via run_tool or fetch_files resource commands.","commonSituations":"Wrong completion flag for the tool (e.g. a flag that prints usage to stderr); command expects a TTY and prints nothing when stdin is null; the tool's completion subcommand was renamed so the command exits without stdout; output was empty because the tool requires an argument.","solutions":["Run the command manually and confirm it prints non-empty output to stdout.","Fix the exec entry to use the correct command/flags that emit stdout (e.g. correct completion subcommand).","Ensure the command doesn't depend on stdin or a TTY (stdin is nulled and stderr discarded in isolated execution).","If output is legitimately huge, reduce it or check it isn't being truncated by the 4MB read cap."],"exampleFix":"# before: prints to stderr, stdout stays empty\nexec = [\"rg\", \"--completion\"]\n\n# after: correct subcommand that prints completions to stdout\nexec = [\"rg\", \"--generate\", \"complete\", \"--\"], # or the tool's documented completion command","handlingStrategy":"validation","validationCode":"let out = Command::new(&program).args(args)\n    .stdin(Stdio::null()).stderr(Stdio::null()).output()?;\nif out.stdout.iter().all(|&b| (b as char).is_whitespace()) {\n    eprintln!(\"{program} prints nothing to stdout; resource commands require non-empty stdout\");\n}","typeGuard":null,"tryCatchPattern":"match run_tool(config, &backend, &tv, &argv, &env).await {\n    Err(e) if e.to_string().contains(\"produced no output\") => {\n        eprintln!(\"Run the command manually; ensure it writes completions to stdout (stderr is discarded)\");\n    }\n    Ok(out) => use(out),\n    Err(e) => return Err(e),\n}","preventionTips":["Confirm resource commands write to stdout, not stderr — stderr is nulled in isolated execution.","Avoid commands requiring TTY or stdin; isolated runs use null stdin.","Keep expected output well under the 4MB read cap.","Test each manifest exec entry by running it manually before shipping."],"tags":["packslip","empty-output","subprocess","stdout"],"backgroundTag":"empty-response-body","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"}