{"record":{"id":"5115c068d3cd0ad2","repo":"nikivdev/code","slug":"gen-returned-no-output","errorCode":null,"errorMessage":"gen returned no output","messagePattern":"gen returned no output","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/agents.rs","lineNumber":1079,"sourceCode":"            cmd.output().context(\"failed to run gen from repo\")\n        }\n    }?;\n\n    if !output.status.success() {\n        bail!(\"gen exited with status: {}\", output.status);\n    }\n\n    let stdout = String::from_utf8_lossy(&output.stdout);\n    if let Some(text) = extract_text_from_gen_output(&stdout) {\n        return Ok(text);\n    }\n\n    let trimmed = stdout.trim();\n    if !trimmed.is_empty() {\n        return Ok(trimmed.to_string());\n    }\n\n    bail!(\"gen returned no output\");\n}\n\nfn invoke_gen_capture_streaming(location: &GenLocation, prompt: &str) -> Result<String> {\n    let mut cmd = match location {\n        GenLocation::Binary(path) => {\n            let mut cmd = Command::new(path);\n            cmd.args([\"run\", \"--format\", \"json\", prompt])\n                .stdin(Stdio::null())\n                .stdout(Stdio::piped())\n                .stderr(Stdio::inherit());\n            cmd\n        }\n        GenLocation::Repo(repo) => {\n            let mut cmd = Command::new(\"bun\");\n            cmd.args([\n                \"run\",\n                \"--cwd\",\n                &repo.join(\"packages/opencode\").to_string_lossy(),","sourceCodeStart":1061,"sourceCodeEnd":1097,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/agents.rs#L1061-L1097","documentation":"After gen exits successfully, invoke_gen_capture tries to extract structured text from gen's output and otherwise falls back to the trimmed stdout. If the output is entirely empty (or only whitespace) even though the exit status was success, it bails with 'gen returned no output' — a contract violation between flow and gen.","triggerScenarios":"gen exits 0 but prints nothing (or only unparseable-empty output): silently failing model call inside gen, gen writing results elsewhere, or a gen version whose output format no longer matches extract_text_from_gen_output.","commonSituations":"Version skew where gen changed its JSON output shape so extraction fails and stdout is blank; gen success-without-work edge cases; redirected/swallowed stdout in wrappers.","solutions":["Run gen manually with the same prompt to inspect its raw stdout.","Upgrade or downgrade gen so its output format matches what extract_text_from_gen_output expects (version alignment with flow).","Check gen's own logs/config for silent failures (missing API key producing empty success).","Ensure nothing in the calling environment redirects or discards gen's stdout."],"exampleFix":"// before\n$ f flow-agent \"summarize\"\nError: gen returned no output\n// after\n$ gen --version && echo 'summarize' | gen   # inspect raw output\n$ # align gen version with flow (git pull in GEN_REPO, reinstall), retry","handlingStrategy":"fallback","validationCode":"out=$(gen \"$PROMPT\" 2>/dev/null); [ -n \"$(echo \"$out\" | tr -d '[:space:]')\" ] \\\n  || { echo \"gen produced empty output\"; exit 1; }","typeGuard":"fn has_output(stdout: &str) -> bool {\n    !stdout.trim().is_empty()\n}","tryCatchPattern":"match invoke_gen_capture(&loc, prompt) {\n    Err(e) if e.to_string() == \"gen returned no output\" => {\n        eprintln!(\"gen succeeded silently; check gen version/output format.\");\n        // fall back to a direct gen invocation to capture raw output\n    }\n    other => other?,\n}","preventionTips":["Pin gen and flow versions so output formats stay compatible.","Monitor gen upgrades for output-format changes affecting extract_text_from_gen_output.","Check gen's API key/config after any empty-success result.","Test gen's raw stdout manually when integration tests report empty output."],"tags":["gen","empty-output","subprocess","contract"],"backgroundTag":"empty-output-from-subprocess","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}