openai/codex · error · anyhow::Error
secret_file must be an absolute path
Error message
secret_file must be an absolute path: {path:?} What it means
Guard in parse_secret_file: the secret_file path is non-empty but relative, and secret files must be absolute so they resolve identically regardless of the proxy process's working directory. The offending input is a relative path string like "secrets/token.txt".
Solutions
- Use an absolute path, e.g. /etc/codex/secrets/token.txt
- Anchor the path to a known root when generating the configuration
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at codex-rs/network-proxy/src/mitm_hook.rs:638 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/a56bc018776b834a.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/network-proxy/src/mitm_hook.rs:638
));
}
}
}
Ok(())
}
fn parse_header_name(name: &str) -> Result<HeaderName> {
HeaderName::from_bytes(name.as_bytes())
.map_err(|err| anyhow!("invalid header name {name:?}: {err}"))
}
fn parse_secret_file(path: &str) -> Result<AbsolutePathBuf> {
if path.trim().is_empty() {
return Err(anyhow!("secret_file must not be empty"));
}
let path = Path::new(path);
if !path.is_absolute() {
return Err(anyhow!("secret_file must be an absolute path: {path:?}"));
}
AbsolutePathBuf::from_absolute_path(path)
.with_context(|| format!("secret_file must be an absolute path: {path:?}"))
}
#[cfg(test)]
mod tests {
use super::*;
use crate::NetworkMode;
use crate::config::NetworkProxyConfig;
use pretty_assertions::assert_eq;
use rama_http::Body;
use rama_http::Method;
use tempfile::NamedTempFile;
fn base_config() -> NetworkProxyConfig {
NetworkProxyConfig {
mitm: true,View on GitHub (pinned to 339751715c)