{"record":{"id":"6b1a839d49622217","repo":"nikivdev/code","slug":"agent-not-found-6b1a83","errorCode":null,"errorMessage":"Agent '{}' not found","messagePattern":"Agent '(.+?)' not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/hive.rs","lineNumber":399,"sourceCode":"#\n# Rules:\n# - <rule 1>\n# - <rule 2>\n#\n# Tools:\n# - bash\n\"#,\n        name\n    );\n\n    fs::write(&path, template)?;\n    Ok(path)\n}\n\n/// Edit an agent spec file\npub fn edit_agent(name: &str) -> Result<()> {\n    let (path, _source) =\n        find_agent_spec(name).ok_or_else(|| anyhow::anyhow!(\"Agent '{}' not found\", name))?;\n\n    let editor = std::env::var(\"EDITOR\").unwrap_or_else(|_| \"vim\".to_string());\n    let status = Command::new(&editor)\n        .arg(&path)\n        .stdin(Stdio::inherit())\n        .stdout(Stdio::inherit())\n        .stderr(Stdio::inherit())\n        .status()\n        .context(format!(\"Failed to open editor '{}'\", editor))?;\n\n    if !status.success() {\n        anyhow::bail!(\"Editor exited with status {:?}\", status.code());\n    }\n\n    Ok(())\n}\n\n/// List agents in a formatted table","sourceCodeStart":381,"sourceCodeEnd":417,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/hive.rs#L381-L417","documentation":"edit_agent looks up an agent spec file by name via find_agent_spec and throws this error when no spec matches the given name. It is thrown before launching $EDITOR so the editor is never opened for a nonexistent agent.","triggerScenarios":"Calling edit_agent (the hive agent-edit command) with a name that matches no agent spec file in any search location (local project, global specs).","commonSituations":"Typo in agent name, agent spec deleted or renamed, running from a directory where the agent isn't defined, expecting fuzzy matching that doesn't exist.","solutions":["List available agents (hive agent list or inspect the specs dir) and use the exact name","Create the agent spec first, then edit it","Run from the project root where the agent spec is defined"],"exampleFix":"// before\nf hive agent edit myagent   # Agent 'myagent' not found\n// after\nf hive agent list           # shows: my-agent\nf hive agent edit my-agent","handlingStrategy":"validation","validationCode":"fn agent_exists(name: &str) -> bool { find_agent_spec(name).is_some() }\nif !agent_exists(name) {\n    eprintln!(\"unknown agent '{}'; list agents first\", name);\n    return Ok(());\n}","typeGuard":null,"tryCatchPattern":"if let Err(e) = edit_agent(name) {\n    if e.to_string().starts_with(\"Agent '\") {\n        eprintln!(\"{} — create it with `f hive agent new {}`\", e, name);\n    } else { return Err(e.into()); }\n}","preventionTips":["Use tab-completion or agent list for names","Run hive commands from the project root where specs live","Create the spec before attempting to edit"],"tags":["cli","agent","not-found"],"backgroundTag":"resource-not-found","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}