nikivdev/code · error
hive agent '{}' exited with status {:?}
Error message
hive agent '{}' exited with status {:?} What it means
`run_agent` spawns `hive agent <agent> <prompt>` with inherited stdio and waits via `.status()`. If the hive process exits with a failure code, the function bails with this message naming the agent and the exit status (as `Option<i32>` via `{:?}`). The actual reason for failure must come from hive's own output, which was streamed to the terminal.
Source
Thrown at src/hive.rs:325
/// Run a hive agent with a prompt
pub fn run_agent(agent: &str, prompt: &str) -> Result<()> {
// Check if hive is available
if which::which("hive").is_err() {
anyhow::bail!("hive not found on PATH. Install from https://github.com/example/hive");
}
let status = Command::new("hive")
.arg("agent")
.arg(agent)
.arg(prompt)
.stdin(Stdio::inherit())
.stdout(Stdio::inherit())
.stderr(Stdio::inherit())
.status()
.context("Failed to run hive")?;
if !status.success() {
anyhow::bail!(
"hive agent '{}' exited with status {:?}",
agent,
status.code()
);
}
Ok(())
}
/// Run an agent interactively (prompt via stdin)
pub fn run_agent_interactive(agent: &str) -> Result<()> {
if which::which("hive").is_err() {
anyhow::bail!("hive not found on PATH");
}
let status = Command::new("hive")
.arg("agent")
.arg(agent)View on GitHub (pinned to a747e741ae)
Solutions
- Check the hive output printed above the error (stdio is inherited) for the real cause
- Verify the agent name exists: `hive agent <name>` or list available agents
- Run the exact command manually to reproduce: `hive agent <agent> "<prompt>"`
- If the status shows `None`, the process died by signal — check dmesg/limits (OOM) or rerun
Example fix
// before
hive::run_agent("reviwer", "do the thing")?; // typo'd agent
// after
let agent = "reviewer"; // exact, existing agent name
match hive::run_agent(agent, "do the thing") {
Err(e) => { eprintln!("agent {agent} failed: {e}"); }
ok => ok?,
} Defensive patterns
Strategy: try-catch
Validate before calling
let known = ["reviewer", "planner", "deploy-agent"];
anyhow::ensure!(
known.contains(&agent),
"unknown hive agent '{}' — check `hive agent --list`",
agent
);
anyhow::ensure!(hive_available(), "hive not on PATH"); Type guard
null
Try / catch
match hive::run_agent(agent, prompt) {
Err(e) if e.to_string().contains("exited with status") => {
eprintln!("hive agent failed; its output was streamed above — inspect it");
if e.to_string().contains("None") {
eprintln!("process died by signal (killed/OOM/Ctrl-C)");
}
}
r => r?,
} Prevention
- Validate agent names against hive's agent list before invoking
- Capture or tee hive output to a log file since the error only carries the exit code
- Set retry/backoff for transient hive backend failures
- Monitor for signal exits (status None) which indicate kills, not hive errors
When it happens
Trigger: hive exiting non-zero for an unknown agent name, invalid prompt, its own internal error, or being killed by a signal (in which case `status.code()` is `None`, printed as `None`).
Common situations: Passing an agent name that has no corresponding hive agent definition; hive failing authentication or hitting an API rate limit; prompt rejected by hive; process killed by OOM-killer or Ctrl-C resulting in a signal exit.
Related errors
- unhash failed: {} {}{}
- Lin.app is not running
- Agent exited with status: {}
- gen exited with status: {}
- codex skill-eval launchd install failed: {}
AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01).
Data as JSON: /api/errors/3ef5b4c1db624d65.
Report an issue: GitHub.