openai/codex · error · anyhow::Error
multiple agents found for canonical path
Error message
multiple agents found for canonical path `{agent_path}` What it means
one_thread_id_from_rows found more than one thread row matching the same canonical agent rollout path. Spawn-child/descendant path lookups assume path uniqueness; duplicates mean two threads share (or symlink to) the same on-disk rollout, so the helper cannot disambiguate and returns this sentinel error.
Solutions
- Inspect the state database for duplicate agent-path entries and delete or merge the stale duplicate thread rows
- Ensure the same canonical rollout directory is not imported/resumed twice under different thread ids
- Normalize the path (dedupe symlinks/case variants) before registering spawn children
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at codex-rs/state/src/runtime/threads.rs:1179 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of openai/codex@339751715c (2026-08-25).
Data as JSON: /api/errors/ae06c8f54ad08ee7.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/state/src/runtime/threads.rs:1179
Ok(rows_affected)
}
}
fn one_thread_id_from_rows(
rows: Vec<sqlx::sqlite::SqliteRow>,
agent_path: &str,
) -> anyhow::Result<Option<ThreadId>> {
let mut ids = rows
.into_iter()
.map(|row| {
let id: String = row.try_get("id")?;
ThreadId::try_from(id).map_err(anyhow::Error::from)
})
.collect::<Result<Vec<_>, _>>()?;
match ids.len() {
0 => Ok(None),
1 => Ok(ids.pop()),
_ => Err(anyhow::anyhow!(
"multiple agents found for canonical path `{agent_path}`"
)),
}
}
fn push_list_threads_query(
builder: &mut QueryBuilder<Sqlite>,
filters: ThreadFilterOptions<'_>,
relation_filter: Option<crate::ThreadRelationFilter>,
limit: usize,
) {
if let Some(crate::ThreadRelationFilter::DescendantsOf(ancestor_thread_id)) = relation_filter {
builder.push(
r#"
WITH RECURSIVE subtree(child_thread_id, parent_thread_id) AS (
SELECT child_thread_id, parent_thread_id
FROM thread_spawn_edges
WHERE parent_thread_id =View on GitHub (pinned to 339751715c)