{"record":{"id":"feed8873672168e2","repo":"nikivdev/code","slug":"missing-profile","errorCode":null,"errorMessage":"Missing profile: {}","messagePattern":"Missing profile: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/agents.rs","lineNumber":156,"sourceCode":"        }\n    }\n\n    let agents_dir = repo_path.join(\"agents\");\n    if !agents_dir.is_dir() {\n        println!(\"No agents/ directory in {}\", repo_path.display());\n        return Ok(());\n    }\n\n    let mut profiles = list_agents_profiles(&agents_dir)?;\n    if profiles.is_empty() {\n        println!(\"No profiles found in {}\", agents_dir.display());\n        return Ok(());\n    }\n    profiles.sort();\n\n    if let Some(name) = &chosen_profile {\n        if !profiles.iter().any(|p| p == name) {\n            bail!(\"Missing profile: {}\", name);\n        }\n    } else {\n        chosen_profile = select_agents_profile(&profiles)?;\n    }\n\n    let Some(profile_name) = chosen_profile else {\n        println!(\"No profile selected.\");\n        return Ok(());\n    };\n\n    let source_lower = agents_dir.join(format!(\"agents.{profile_name}.md\"));\n    let source_upper = agents_dir.join(format!(\"AGENTS.{profile_name}.md\"));\n    let source = if source_lower.is_file() {\n        source_lower\n    } else {\n        source_upper\n    };\n    if !source.is_file() {","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/agents.rs#L138-L174","documentation":"copy_agent_instructions in src/agents.rs looks up an agent by exact name among the discovered AgentEntry list when an agent name is passed explicitly. If no entry matches, it bails with \"Agent '<name>' not found\". Built-in/known agents come from build_agent_entries; only those names are valid.","triggerScenarios":"Calling flow with an explicit agent name (`--agent <name>` or equivalent) where <name> does not exactly match any AgentEntry.name — including case or hyphen/underscore mismatches — or when the gen-based agent list is unavailable so gen-sourced entries are missing.","commonSituations":"Typo in the agent name; renamed agent in a newer version; agent defined only in the gen repo which isn't installed (see find_gen errors); case-sensitivity (\"Review\" vs \"review\").","solutions":["List available agents (run without --agent to get the interactive/fzf picker) and copy the exact name.","Check spelling and case of the agent name you passed.","Ensure the gen repo is installed/GEN_REPO set if the agent lives there, so its entries are registered."],"exampleFix":"// before\n- flow agents --agent code-reviewer\n// after (match exact entry name)\n+ flow agents --agent review","handlingStrategy":"validation","validationCode":"// list valid names first\nlet names: Vec<_> = entries.iter().map(|e| e.name.as_str()).collect();\nif !names.contains(&requested_name) {\n    eprintln!(\"unknown agent {:?}; valid: {:?}\", requested_name, names);\n}","typeGuard":"fn is_known_agent(name: &str, entries: &[AgentEntry]) -> bool {\n    entries.iter().any(|e| e.name == name)\n}","tryCatchPattern":"match copy_agent_instructions(Some(name)) {\n    Err(e) if e.to_string().contains(\"not found\") => {\n        eprintln!(\"agent {:?} unknown; run the picker to list names\", name);\n    }\n    r => r?,\n}","preventionTips":["Copy agent names exactly from the picker/list output.","Install the gen repo if your agents come from gen.","Watch for renames when upgrading flow."],"tags":["cli","agent-lookup","invalid-argument"],"backgroundTag":"unknown-identifier","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}