nikivdev/code · error
AI task '{}' is ambiguous. Matches: - {} Try one of the fu
Error message
AI task '{}' is ambiguous.
Matches:
- {}
Try one of the full selectors above. What it means
Thrown by select_task in src/ai_tasks.rs when the AI task selector given on the command line matches more than one discovered task. The library cannot guess which task the user meant, so it bails with the list of matching task IDs and asks the user to use a full selector.
Source
Thrown at src/ai_tasks.rs:228
})
.collect();
}
if matches.is_empty() {
return Ok(None);
}
if matches.len() == 1 {
return Ok(Some(matches[0]));
}
let mut msg = String::new();
msg.push_str(&format!("AI task '{}' is ambiguous.\n", selector));
msg.push_str("Matches:\n");
for m in &matches {
msg.push_str(&format!(" - {}\n", m.id));
}
msg.push_str("Try one of the full selectors above.");
bail!(msg);
}
pub fn run_task(task: &DiscoveredAiTask, project_root: &Path, args: &[String]) -> Result<()> {
if !task_has_workspace(task, project_root) {
return run_task_via_moon(task, project_root, args);
}
let runtime = std::env::var("FLOW_AI_TASK_RUNTIME")
.ok()
.unwrap_or_else(|| "cached".to_string())
.to_ascii_lowercase();
if runtime == "moon-run" || runtime == "moon" {
return run_task_via_moon(task, project_root, args);
}
match run_task_cached(task, project_root, args) {
Ok(()) => Ok(()),View on GitHub (pinned to a747e741ae)
Solutions
- Re-run with the exact full task ID shown in the 'Matches:' list
- Disambiguate with a longer prefix that uniquely identifies one task
- Rename one of the colliding tasks so their IDs no longer share the ambiguous prefix
Example fix
// before
run_ai_task("build")?;
// after
run_ai_task("build-docs")?; // or another full selector from the Matches list Defensive patterns
Strategy: validation
Validate before calling
fn is_unambiguous<'a>(tasks: &[&'a AiTask], selector: &str) -> bool {
tasks.iter().filter(|t| t.id.starts_with(selector)).count() == 1
} Try / catch
match select_task(selector) {
Ok(task) => run_task(task, root, args),
Err(e) if e.to_string().contains("is ambiguous") => {
eprintln!("{}\nPlease pick a full task ID.", e);
std::process::exit(2);
}
Err(e) => return Err(e),
} Prevention
- Use the full task ID or a uniquely long prefix
- List available tasks first and pick from that list
- Rename tasks that share prefixes
When it happens
Trigger: Calling select_task (or a CLI command that resolves an AI task by name) with a selector string that is a non-unique prefix or substring of multiple task IDs, e.g. 'build' when both 'build-docs' and 'build-app' exist.
Common situations: Projects with similarly named AI tasks (shared prefixes); users typing short abbreviations; newly added tasks that collide with an existing prefix after a version change.
Related errors
- agent run requires a non-empty query
- unsupported codex open action: {}
- archive message cannot be empty
- archive message must include at least one letter or number
- Template not found: {}
AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01).
Data as JSON: /api/errors/6d7e18c92334ead5.
Report an issue: GitHub.