affaan-m/ECC · error · anyhow::Error

Unknown agent profile

Error message

Unknown agent profile: {name}

What it means

ecc2 resolves named agent profiles from configuration by looking them up in the `agent_profiles` map. When the requested profile name is not defined in config, it returns this error instead of silently falling back. The error is raised inside recursive profile resolution, so it also fires when an `inherits` parent name points to a profile that does not exist.

Solutions

  1. Run the config/profile listing command (or inspect the config file) to see the exact defined profile names and correct the typo in the name argument.
  2. Add the missing profile definition under `agent_profiles` in the ecc2 config file.
  3. If the error mentions a parent chain, check each profile's `inherits` field and point it at an existing profile or remove the inherits line.
  4. If the profile was defined in a project-local config, run from the project directory or pass the config path explicitly.

Example fix

// before (config.toml)
[agent_profiles.reviewer]
inherits = "senior-reviewer"  # parent not defined -> "Unknown agent profile: senior-reviewer"

// after
[agent_profiles.senior-reviewer]
prompt = "You are a senior reviewer..."

[agent_profiles.reviewer]
inherits = "senior-reviewer"
Defensive patterns

Strategy: validation

Validate before calling

// shell: verify the profile exists before invoking
ecc2 config show | grep -q "^\[agent_profiles.$NAME\]" || { echo "profile '$NAME' not defined"; exit 1; }

Type guard

fn profile_exists(cfg: &Config, name: &str) -> bool {
    cfg.agent_profiles.contains_key(name)
}

Prevention

When it happens

Trigger: Calling any command that resolves an agent profile by name (e.g. `resolve_agent_profile(name)`) where `name` is absent from `cfg.agent_profiles`, or where a profile's `inherits` field names a nonexistent parent profile.

Common situations: Typos in a profile name on the CLI or in a config file; renaming or deleting a profile in ecc2 config while other profiles still inherit from it; copying a config from another machine that defined a custom profile; referencing a built-in profile name that has been removed.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/aed6d9e511a8eb32. Report an issue: GitHub.

Appendix: source

Thrown at ecc2/src/config/mod.rs:479

            task_group,
            steps,
        })
    }

    fn resolve_agent_profile_inner(
        &self,
        name: &str,
        chain: &mut Vec<String>,
    ) -> Result<ResolvedAgentProfile> {
        if chain.iter().any(|existing| existing == name) {
            chain.push(name.to_string());
            anyhow::bail!("agent profile inheritance cycle: {}", chain.join(" -> "));
        }

        let profile = self
            .agent_profiles
            .get(name)
            .ok_or_else(|| anyhow::anyhow!("Unknown agent profile: {name}"))?;

        chain.push(name.to_string());
        let mut resolved = if let Some(parent) = profile.inherits.as_deref() {
            self.resolve_agent_profile_inner(parent, chain)?
        } else {
            ResolvedAgentProfile::default()
        };
        chain.pop();

        resolved.apply(name, profile);
        Ok(resolved)
    }

    pub fn load() -> Result<Self> {
        let global_paths = Self::global_config_paths();
        let project_paths = std::env::current_dir()
            .ok()
            .map(|cwd| Self::project_config_paths_from(&cwd))

View on GitHub (pinned to 8321021c54)