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

Unsupported agent type

Error message

Unsupported agent type: {other}

What it means

agent_program falls back to built-in defaults only for known harness kinds (Claude, Codex, OpenCode, Gemini). Any other agent type has no default executable, so the library bails with 'Unsupported agent type'. HarnessKind::from_agent_type must have produced an unknown/other variant, meaning the agent_type string is not one of the recognized values.

Solutions

  1. Use one of the supported agent types: claude, codex, opencode, gemini
  2. Fix the typo in the agent type string
  3. If you need a custom agent, configure a harness_runner entry for its runner_key so the early return branch is used instead of the match
  4. Upgrade the library if the agent type was added in a newer version

Example fix

// before
launch_session(db, cfg, agent_type = "claude-code")?;
// after
launch_session(db, cfg, agent_type = "claude")?; // supported: claude | codex | opencode | gemini
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED: &[&str] = &["claude", "codex", "opencode", "gemini"];
if !SUPPORTED.contains(&agent_type) {
    return Err(format!("unsupported agent type '{agent_type}'; expected one of {SUPPORTED:?}"));
}

Type guard

fn is_supported_agent(t: &str) -> bool { matches!(t, "claude" | "codex" | "opencode" | "gemini") }

Try / catch

match launch(...) {
    Err(e) if e.to_string().starts_with("Unsupported agent type") => {
        eprintln!("use claude, codex, opencode, or gemini; or configure a harness_runner");
        Err(e)
    }
    other => other,
}

Prevention

When it happens

Trigger: Calling a session-launch API with an agent_type string that HarnessKind::from_agent_type does not map to Claude/Codex/OpenCode/Gemini, so agent_program reaches the match's `other` arm. (The DECLARED AS references to `other` in harness_eval.rs canonicalize are unrelated wildcard bindings, not this error's source.)

Common situations: Typo in agent type name (e.g., 'claude-code' vs 'claude'); a newly added agent type not yet supported by this build; passing an arbitrary runner key instead of an agent type; plugin registering a custom agent without a configured harness_runner.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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

Appendix: source

Thrown at ecc2/src/session/manager.rs:2345

}

fn agent_program(cfg: &Config, agent_type: &str) -> Result<PathBuf> {
    let harness = HarnessKind::from_agent_type(agent_type);
    let runner_key = SessionHarnessInfo::runner_key(agent_type);
    if let Some(runner) = cfg.harness_runner(&runner_key) {
        let program = runner.program.trim();
        if program.is_empty() {
            anyhow::bail!("Configured harness runner for {runner_key} is missing a program");
        }
        return Ok(PathBuf::from(program));
    }

    match harness {
        HarnessKind::Claude => Ok(PathBuf::from("claude")),
        HarnessKind::Codex => Ok(PathBuf::from("codex")),
        HarnessKind::OpenCode => Ok(PathBuf::from("opencode")),
        HarnessKind::Gemini => Ok(PathBuf::from("gemini")),
        other => anyhow::bail!("Unsupported agent type: {other}"),
    }
}

fn resolve_session(db: &StateStore, id: &str) -> Result<Session> {
    let session = if id == "latest" {
        db.get_latest_session()?
    } else {
        db.get_session(id)?
    };

    session.ok_or_else(|| anyhow::anyhow!("Session not found: {id}"))
}

fn parse_cron_schedule(expr: &str) -> Result<CronSchedule> {
    let trimmed = expr.trim();
    let normalized = match trimmed.split_whitespace().count() {
        5 => format!("0 {trimmed}"),
        6 | 7 => trimmed.to_string(),

View on GitHub (pinned to 8321021c54)