{"record":{"id":"0569bbe2e20a6b53","repo":"nikivdev/code","slug":"resolver-returned-empty-output-for","errorCode":null,"errorMessage":"resolver {} returned empty output for {}","messagePattern":"resolver (.+?) returned empty output for (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/ai.rs","lineNumber":12598,"sourceCode":"            .current_dir(target_path)\n            .output()\n            .with_context(|| format!(\"failed to run resolver {}\", resolver.name))?;\n        if !output.status.success() {\n            let stderr = String::from_utf8_lossy(&output.stderr).trim().to_string();\n            bail!(\n                \"resolver {} failed for {}: {}\",\n                resolver.name,\n                candidate,\n                if stderr.is_empty() {\n                    format!(\"exit status {}\", output.status)\n                } else {\n                    stderr\n                }\n            );\n        }\n        let stdout = String::from_utf8_lossy(&output.stdout).trim().to_string();\n        if stdout.is_empty() {\n            bail!(\n                \"resolver {} returned empty output for {}\",\n                resolver.name,\n                candidate\n            );\n        }\n\n        return Ok(Some(CodexResolvedReference {\n            name: resolver\n                .inject_as\n                .clone()\n                .unwrap_or_else(|| resolver.name.clone()),\n            source: \"resolver\".to_string(),\n            matched: candidate.clone(),\n            command: Some(command_text),\n            output: compact_codex_context_block(&stdout, 12, 1200),\n        }));\n    }\n","sourceCodeStart":12580,"sourceCodeEnd":12616,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/ai.rs#L12580-L12616","documentation":"A resolver command may exit successfully but produce no stdout; since the resolver's stdout is the selected session/candidate, an empty result is unusable and the tool bails naming the resolver and candidate. This guards against silently proceeding with an empty selection.","triggerScenarios":"Resolver exits 0 but prints nothing: the picker was fed no input lines, a filter matched nothing and the script swallows the exit code, or the script writes results to stderr instead of stdout.","commonSituations":"Resolver script piping an empty session list into fzf; scripts that `echo` diagnostics but forget to print the selection; quoting bugs redirecting the selection to the wrong stream.","solutions":["Ensure the resolver prints the selected candidate to stdout","Fix the resolver script to emit the value (not stderr) and exit 0 only with output","Verify the input fed to the resolver is non-empty before invoking"],"exampleFix":"// before\npick | grep -i foo >/dev/null\n// after\nprintf '%s\\n' \"$pick\" | grep -i foo | head -1","handlingStrategy":"validation","validationCode":"let out = Command::new(&program).args(&rest).current_dir(&dir).output()?;\nlet stdout = String::from_utf8_lossy(&out.stdout).trim().to_string();\nif !out.status.success() || stdout.is_empty() {\n    eprintln!(\"resolver '{}' produced no usable output\", resolver.name);\n}","typeGuard":"fn resolver_output_ok(out: &std::process::Output) -> bool {\n    out.status.success() && !String::from_utf8_lossy(&out.stdout).trim().is_empty()\n}","tryCatchPattern":null,"preventionTips":["Resolver scripts must print the selection to stdout","Feed resolvers non-empty input; check upstream list first","Add `set -euo pipefail` and an explicit echo of the result in resolver scripts"],"tags":["resolver","subprocess","empty-output","validation"],"backgroundTag":"empty-command-output","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}