openai/codex · error · std::io::Error
failed to parse agent role file at {}: {err}
Error message
failed to parse agent role file at {}: {err} What it means
Error "failed to parse agent role file at {}: {err}" thrown in openai/codex.
Source
Thrown at codex-rs/core/src/config/agent_roles.rs:241
config: ConfigToml,
}
#[derive(Debug, Clone, PartialEq)]
pub(crate) struct ResolvedAgentRoleFile {
pub(crate) role_name: String,
pub(crate) description: Option<String>,
pub(crate) nickname_candidates: Option<Vec<String>>,
pub(crate) config: TomlValue,
}
pub(crate) fn parse_agent_role_file_contents(
contents: &str,
role_file_label: &Path,
config_base_dir: &Path,
role_name_hint: Option<&str>,
) -> std::io::Result<ResolvedAgentRoleFile> {
let role_file_toml: TomlValue = toml::from_str(contents).map_err(|err| {
std::io::Error::new(
std::io::ErrorKind::InvalidData,
format!(
"failed to parse agent role file at {}: {err}",
role_file_label.display()
),
)
})?;
let _guard = AbsolutePathBufGuard::new(config_base_dir);
let parsed: RawAgentRoleFileToml = role_file_toml.clone().try_into().map_err(|err| {
std::io::Error::new(
std::io::ErrorKind::InvalidData,
format!(
"failed to deserialize agent role file at {}: {err}",
role_file_label.display()
),
)
})?;
let description = normalize_agent_role_description(View on GitHub (pinned to 339751715c)
Solutions
- Fix the TOML syntax in the agent role file at the reported path.
When it happens
Trigger: Thrown at codex-rs/core/src/config/agent_roles.rs:241 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of openai/codex@339751715c (2026-08-25).
Data as JSON: /api/errors/e682f8af69b3b240.
Report an issue: GitHub.