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

websocket auth secret

Error message

websocket auth secret {} must not be empty

What it means

Validation error in read_trimmed_secret: the secret file was read successfully, but after trimming whitespace its contents are empty. An empty shared secret or token can never authenticate, so it is treated as misconfiguration.

Solutions

  1. Write the actual secret value into the file (no file should be a placeholder).
  2. Check secret provisioning — a failed mount or truncated write often yields an empty file.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at codex-rs/app-server-transport/src/transport/auth.rs:413 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/8959eadf79b98b76. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/app-server-transport/src/transport/auth.rs:413

            ),
        ));
    }
    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> {
    AbsolutePathBuf::try_from(path).with_context(|| format!("{flag_name} must be an absolute path"))
}

fn sha256_digest_arg(flag_name: &str, value: &str) -> anyhow::Result<[u8; 32]> {
    let trimmed = value.trim();
    if trimmed.len() != 64 {
        anyhow::bail!("{flag_name} must be a 64-character hex SHA-256 digest");
    }

    let mut digest = [0u8; 32];

View on GitHub (pinned to 339751715c)