nikivdev/code · error
gen exited with status: {}
Error message
gen exited with status: {} What it means
invoke_gen_capture spawns the gen binary (Binary or repo location) to run the flow prompt and checks the exit status. A non-zero status bails with 'gen exited with status: <status>'. The raw gen output is discarded on failure, so the underlying gen error must be reproduced manually.
Source
Thrown at src/agents.rs:1066
"run",
"--cwd",
&repo.join("packages/opencode").to_string_lossy(),
"--conditions=browser",
"src/index.ts",
"run",
"--format",
"json",
prompt,
])
.env("GEN_MODE", "1")
.stdin(Stdio::null());
apply_project_config_env(&mut cmd);
cmd.output().context("failed to run gen from repo")
}
}?;
if !output.status.success() {
bail!("gen exited with status: {}", output.status);
}
let stdout = String::from_utf8_lossy(&output.stdout);
if let Some(text) = extract_text_from_gen_output(&stdout) {
return Ok(text);
}
let trimmed = stdout.trim();
if !trimmed.is_empty() {
return Ok(trimmed.to_string());
}
bail!("gen returned no output");
}
fn invoke_gen_capture_streaming(location: &GenLocation, prompt: &str) -> Result<String> {
let mut cmd = match location {
GenLocation::Binary(path) => {View on GitHub (pinned to a747e741ae)
Solutions
- Run gen directly with the same prompt/location to see its real error output.
- Verify GEN_REPO points to a valid gen checkout or install the binary (`cd <gen-repo> && f install`, or set GEN_REPO per gen_repo_hint()).
- Rebuild/update gen (`cargo build` / git pull in the gen repo).
- Check env vars injected by apply_project_config_env for anything gen rejects.
Example fix
// before $ f flow-agent "do thing" Error: gen exited with status: exit status: 101 // after $ cd "$GEN_REPO" && git pull && cargo build --release && f install $ f flow-agent "do thing" # succeeds
Defensive patterns
Strategy: retry
Validate before calling
[ -n "${GEN_REPO:-}" ] && [ -d "$GEN_REPO/.git" ] && gen --version >/dev/null \
|| { echo "GEN_REPO invalid or gen missing"; exit 1; } Type guard
fn gen_ready() -> bool {
std::process::Command::new("gen").arg("--version").output()
.map(|o| o.status.success()).unwrap_or(false)
} Try / catch
match invoke_gen_capture(&loc, prompt) {
Err(e) if e.to_string().starts_with("gen exited with status") => {
eprintln!("gen failed; run gen manually with the same prompt for details.");
// fix install/auth, then retry
}
other => other?,
} Prevention
- Keep GEN_REPO pointing at a valid, up-to-date gen checkout.
- Rebuild/reinstall gen after pulling changes.
- Verify gen runs the same prompt successfully before blaming flow.
- Review project config env vars passed into the gen subprocess.
When it happens
Trigger: gen returns non-zero while executing the flow prompt — bad GEN_REPO checkout, gen build failure, gen-side error processing the prompt, or project-config env vars breaking gen.
Common situations: GEN_REPO env var set to a path that is not a working gen repo; gen binary out of date relative to flow's expectations; network/model-credential failure inside gen; large prompt causing gen to fail.
Related errors
- Lin.app is not running
- gen agent list failed
- gen agent list failed: {}
- Agent exited with status: {}
- gen returned no output
AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01).
Data as JSON: /api/errors/744bd8e38a90e932.
Report an issue: GitHub.