{"record":{"id":"f377b7da0aa75411","repo":"nikivdev/code","slug":"gen-agent-list-failed","errorCode":null,"errorMessage":"gen agent list failed","messagePattern":"gen agent list failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/agents.rs","lineNumber":770,"sourceCode":"                &repo.join(\"packages/opencode\").to_string_lossy(),\n                \"--conditions=browser\",\n                \"src/index.ts\",\n                \"agent\",\n                \"list\",\n            ])\n            .env(\"GEN_MODE\", \"1\")\n            .stdin(Stdio::inherit())\n            .stdout(Stdio::inherit())\n            .stderr(Stdio::inherit());\n            apply_project_config_env(&mut cmd);\n            cmd.status().context(\"failed to run gen agent list\")?\n        }\n    };\n\n    if status.success() {\n        Ok(())\n    } else {\n        bail!(\"gen agent list failed\");\n    }\n}\n\nfn fetch_gen_agent_entries() -> Result<Vec<AgentEntry>> {\n    let gen_loc = find_gen().ok_or_else(|| {\n        anyhow::anyhow!(\n            \"gen not found. Install with:\\n  cd {} && f install\\n  # or set GEN_REPO env var\",\n            gen_repo_hint()\n        )\n    })?;\n\n    let output = match gen_loc {\n        GenLocation::Binary(ref path) => Command::new(path)\n            .args([\"agent\", \"list\"])\n            .output()\n            .context(\"failed to run gen agent list\")?,\n        GenLocation::Repo(ref repo) => {\n            let mut cmd = Command::new(\"bun\");","sourceCodeStart":752,"sourceCodeEnd":788,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/agents.rs#L752-L788","documentation":"list_gen_agents shells out to the external `gen` binary to list agents and propagates only its exit status. When the subprocess exits non-zero it bails with the generic message 'gen agent list failed' without including stderr, so the underlying cause is hidden. It is a thin wrapper failure over the external tool.","triggerScenarios":"Running `f agents list` when the underlying `gen agent list` subprocess returns a non-zero exit status (gen crashed, bad config, missing agent store, incompatible gen version).","commonSituations":"GEN_REPO pointing at an invalid/broken checkout; gen not fully installed; gen's agent list subcommand renamed or failing due to environment variables from apply_project_config_env.","solutions":["Run `gen agent list` directly to see the real error output.","Verify gen is installed and on PATH and that GEN_REPO (if set) points to a valid gen repo (`gen_repo_hint()` output).","Reinstall or update gen (`cd <gen-repo> && f install`).","Check project config env vars that apply_project_config_env injects for anything breaking gen."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"gen agent list >/dev/null 2>&1 || { echo \"gen broken: run 'gen agent list' to diagnose\"; exit 1; }\nf agents list","typeGuard":"fn gen_available() -> bool {\n    std::process::Command::new(\"gen\")\n        .arg(\"--version\").output()\n        .map(|o| o.status.success()).unwrap_or(false)\n}","tryCatchPattern":"if let Err(e) = list_gen_agents(&gen_loc) {\n    if e.to_string() == \"gen agent list failed\" {\n        // rerun `gen agent list` manually to surface the hidden stderr\n    }\n}","preventionTips":["Verify `gen agent list` works standalone before using `f agents list`.","Keep gen installed and updated in the GEN_REPO checkout.","Audit flow.toml env values that get injected into the gen subprocess.","Retry once after fixing gen; the error hides diagnostics so always reproduce manually."],"tags":["subprocess","external-tool","gen"],"backgroundTag":"subprocess-nonzero-exit","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}