openai/codex · error · io::Error

Failed to read project hooks config file

Error message

Failed to read project hooks config file {}: {err}

What it means

Reading or parsing a project's hooks config file under a trusted .codex/hooks directory failed with an unexpected error {err}; because the project is trusted, the malformed hooks config is treated as fatal rather than ignored.

Solutions

  1. Check that the project hooks config file exists and is readable.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at codex-rs/config/src/loader/mod.rs:1667 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/87030656b44161ee. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/config/src/loader/mod.rs:1667

                        if is_trusted {
                            return Err(io::Error::new(
                                io::ErrorKind::InvalidData,
                                format!(
                                    "Error parsing project hooks config file {}: {err}",
                                    hooks_config_file.as_path().display()
                                ),
                            ));
                        }
                        TomlValue::Table(toml::map::Map::new())
                    }
                };
                parsed
            }
            Err(err) if err.kind() == io::ErrorKind::NotFound => {
                TomlValue::Table(toml::map::Map::new())
            }
            Err(err) => {
                return Err(io::Error::new(
                    err.kind(),
                    format!(
                        "Failed to read project hooks config file {}: {err}",
                        hooks_config_file.as_path().display()
                    ),
                ));
            }
        },
    )
}
/// The legacy mechanism for specifying admin-enforced configuration is to read
/// from a file like `/etc/codex/managed_config.toml` that has the same
/// structure as `config.toml` where fields like `approval_policy` can specify
/// exactly one value rather than a list of allowed values.
///
/// If present, re-interpret `managed_config.toml` as a `requirements.toml`
/// where each specified field is treated as a constraint. Most fields allow
/// only the specified value. `approvals_reviewer = "auto_review"` also allows

View on GitHub (pinned to 339751715c)