openai/codex · error · std::io::Error

failed to parse agent role file at

Error message

failed to parse agent role file at {}: {err}

What it means

parse_agent_role_file_contents could not parse the role file's bytes as TOML; {err} is the toml parse error with line/column. The file at the displayed path is syntactically invalid and must be fixed before the role can load.

Solutions

  1. Fix the TOML syntax in the agent role file at the reported path.
Defensive patterns

Strategy: validation

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


AI-assisted analysis of openai/codex@339751715c (2026-08-25). Data as JSON: /api/errors/e682f8af69b3b240. Report an issue: GitHub.

Appendix: 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)