zeroclaw-labs/zeroclaw · error · anyhow::Error

Ambiguous name ' ': matched jobs — use the job ID instead

Error message

Ambiguous name '{id_or_name}': matched {n} jobs — use the job ID instead

What it means

Disambiguation failure in resolve_job_id_or_name: the lowercased name matched more than one of the requesting agent's own cron jobs. Because a name cannot uniquely identify which job to act on, the operation is refused and the message directs the caller to use the unique job id instead.

Solutions

  1. Use the unique job ID instead of the ambiguous name.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/zeroclaw-runtime/src/cron/store.rs:279 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23). Data as JSON: /api/errors/44581d155610ea7a. Report an issue: GitHub.

Appendix: source

Thrown at crates/zeroclaw-runtime/src/cron/store.rs:279

    agent_alias: &str,
) -> Result<String> {
    // Fast path: try exact ID lookup first.
    if let Ok(job) = get_job(config, id_or_name) {
        return Ok(job.id);
    }

    // Fallback: search by name within the requesting agent's own jobs.
    let jobs = list_jobs_by_agent(config, agent_alias)?;
    let lower = id_or_name.to_lowercase();
    let matches: Vec<&CronJob> = jobs
        .iter()
        .filter(|j| j.name.as_deref().is_some_and(|n| n.to_lowercase() == lower))
        .collect();

    match matches.len() {
        0 => anyhow::bail!("No cron job found with id or name '{id_or_name}'"),
        1 => Ok(matches[0].id.clone()),
        n => anyhow::bail!(
            "Ambiguous name '{id_or_name}': matched {n} jobs — use the job ID instead"
        ),
    }
}

pub fn remove_job(config: &Config, id: &str) -> Result<()> {
    let changed = with_initialized_connection(config, |conn| {
        conn.execute("DELETE FROM cron_jobs WHERE id = ?1", params![id])
            .context("Failed to delete cron job")
    })?;

    if changed == 0 {
        anyhow::bail!("Cron job '{id}' not found");
    }

    ::zeroclaw_log::record!(
        INFO,
        ::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Delete)

View on GitHub (pinned to 88bb9c8533)