{"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":1394,"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":1376,"sourceCodeEnd":1412,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/packslip.rs#L1376-L1412","documentation":"run_resource_command runs the tool's own executable in isolation (null stdin/stderr, timeout, 4 MiB output cap) and returns its stdout. If the captured output is empty after trimming, mise cannot use it as a resource (e.g. a completion script) and bails with this error.","triggerScenarios":"The invoked command exits without writing anything to stdout — the tool's completions subcommand prints to stderr, the command requires args it did not get, it detects non-TTY and prints nothing, or it times out producing partial/empty output.","commonSituations":"Wrong subcommand for generating completions, tool needs an env/flag to emit output, tool writes completions to a file instead of stdout, silent failure swallowed because stderr is nulled.","solutions":["Run the same command manually to see stderr and confirm it prints to stdout","Fix the exec entry to call the correct completion/output subcommand with required flags","Check the tool's requirements (env vars, config) so it produces output non-interactively","Watch for timeouts if the tool hangs; increase config timeout if legitimately slow"],"exampleFix":"// before\n// exec = [\"mytool\"]                      # prints nothing\n// after\n// exec = [\"mytool\", \"completions\", \"zsh\"]  # writes the completion script to stdout","handlingStrategy":"try-catch","validationCode":"// run the command manually first; ensure it writes non-empty stdout\nconst out = execSync('mytool completions zsh', {stdio: ['ignore','pipe','inherit']}).toString();","typeGuard":null,"tryCatchPattern":"try { out = await runResourceCommand(...) } catch (e) { if (/produced no output/.test(e.message)) { tryNextResourceSource(); } else { throw e; } }","preventionTips":["Confirm the subcommand prints the artifact to stdout","Run the exact command interactively before adding it to the packslip","Ensure required env/config for non-TTY runs","Beware timeouts on slow tools"],"tags":["packslip","exec","empty-output","completion"],"backgroundTag":"empty-response-body","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}