openai/codex · error · std::io::Error
failed to read websocket auth secret
Error message
failed to read websocket auth secret {}: {err} What it means
I/O error wrapper in read_trimmed_secret: the websocket auth secret file at the given path could not be read (missing file, bad permissions, or a read failure). The original OS error kind and message are preserved and prefixed with the path for diagnosis.
Solutions
- Verify the secret file exists and the server process has read permission on it.
- Fix the path passed via --ws-shared-secret-file / --ws-token-file (it must be absolute).
- If using a mounted secret, confirm the mount completed before server startup, or add retry logic around startup.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at codex-rs/app-server-transport/src/transport/auth.rs:403 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/98d52a3bd46c0ab4.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/app-server-transport/src/transport/auth.rs:403
Ok(token)
}
fn validate_signed_bearer_secret(path: &Path, shared_secret: &[u8]) -> io::Result<()> {
if shared_secret.len() < MIN_SIGNED_BEARER_SECRET_BYTES {
return Err(io::Error::new(
ErrorKind::InvalidInput,
format!(
"signed websocket bearer secret {} must be at least {MIN_SIGNED_BEARER_SECRET_BYTES} bytes",
path.display()
),
));
}
Ok(())
}
fn read_trimmed_secret(path: &std::path::Path) -> io::Result<String> {
let raw = std::fs::read_to_string(path).map_err(|err| {
io::Error::new(
err.kind(),
format!(
"failed to read websocket auth secret {}: {err}",
path.display()
),
)
})?;
let trimmed = raw.trim();
if trimmed.is_empty() {
return Err(io::Error::new(
ErrorKind::InvalidInput,
format!("websocket auth secret {} must not be empty", path.display()),
));
}
Ok(trimmed.to_string())
}
fn absolute_path_arg(flag_name: &str, path: PathBuf) -> anyhow::Result<AbsolutePathBuf> {View on GitHub (pinned to 339751715c)