openai/codex · error · std::io::Error
failed to load AGENTS.md instructions for environment `{}`:
Error message
failed to load AGENTS.md instructions for environment `{}`: {error} What it means
Error "failed to load AGENTS.md instructions for environment `{}`: {error}" thrown in openai/codex.
Source
Thrown at codex-rs/core/src/agents_md.rs:117
sandbox.as_ref(),
)
.await
{
Ok(Some(docs)) => {
for entry in docs.entries {
remaining = remaining.saturating_sub(entry.contents.len());
loaded.entries.push(entry);
}
}
Ok(None) => {}
Err(error) if sandbox.is_none() => {
error!(
environment_id = turn_environment.selection.environment_id,
"error trying to find AGENTS.md docs: {error:#}"
);
}
Err(error) => {
return Err(io::Error::new(
error.kind(),
format!(
"failed to load AGENTS.md instructions for environment `{}`: {error}",
turn_environment.selection.environment_id
),
));
}
}
}
Ok((!loaded.is_empty()).then_some(loaded))
}
/// Attempt to locate and load AGENTS.md documentation.
///
/// On success returns `Ok(Some(loaded))` where `loaded` contains every
/// discovered doc. If no documentation file is found the function returns
/// `Ok(None)`. Unexpected I/O failures bubble up as `Err` so callers canView on GitHub (pinned to 339751715c)
Solutions
- Check that the AGENTS.md file exists and is readable in the reported environment.
When it happens
Trigger: Thrown at codex-rs/core/src/agents_md.rs:117 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/9726ddfdf3e5abfb.
Report an issue: GitHub.