nikivdev/code · error

Missing profile: {}

Error message

Missing profile: {}

What it means

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.

Source

Thrown at src/agents.rs:156

        }
    }

    let agents_dir = repo_path.join("agents");
    if !agents_dir.is_dir() {
        println!("No agents/ directory in {}", repo_path.display());
        return Ok(());
    }

    let mut profiles = list_agents_profiles(&agents_dir)?;
    if profiles.is_empty() {
        println!("No profiles found in {}", agents_dir.display());
        return Ok(());
    }
    profiles.sort();

    if let Some(name) = &chosen_profile {
        if !profiles.iter().any(|p| p == name) {
            bail!("Missing profile: {}", name);
        }
    } else {
        chosen_profile = select_agents_profile(&profiles)?;
    }

    let Some(profile_name) = chosen_profile else {
        println!("No profile selected.");
        return Ok(());
    };

    let source_lower = agents_dir.join(format!("agents.{profile_name}.md"));
    let source_upper = agents_dir.join(format!("AGENTS.{profile_name}.md"));
    let source = if source_lower.is_file() {
        source_lower
    } else {
        source_upper
    };
    if !source.is_file() {

View on GitHub (pinned to a747e741ae)

Solutions

  1. List available agents (run without --agent to get the interactive/fzf picker) and copy the exact name.
  2. Check spelling and case of the agent name you passed.
  3. Ensure the gen repo is installed/GEN_REPO set if the agent lives there, so its entries are registered.

Example fix

// before
- flow agents --agent code-reviewer
// after (match exact entry name)
+ flow agents --agent review
Defensive patterns

Strategy: validation

Validate before calling

// list valid names first
let names: Vec<_> = entries.iter().map(|e| e.name.as_str()).collect();
if !names.contains(&requested_name) {
    eprintln!("unknown agent {:?}; valid: {:?}", requested_name, names);
}

Type guard

fn is_known_agent(name: &str, entries: &[AgentEntry]) -> bool {
    entries.iter().any(|e| e.name == name)
}

Try / catch

match copy_agent_instructions(Some(name)) {
    Err(e) if e.to_string().contains("not found") => {
        eprintln!("agent {:?} unknown; run the picker to list names", name);
    }
    r => r?,
}

Prevention

When it happens

Trigger: 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.

Common situations: 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").

Related errors


AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01). Data as JSON: /api/errors/feed8873672168e2. Report an issue: GitHub.