openai/codex · error · anyhow::Error

failed to create cert params

Error message

failed to create cert params: {err}

What it means

issue_host_certificate_pem failed while constructing rcgen CertificateParams for the host being MITM-proxied — either the empty SAN list (IP host) or the single-host-name variant rejected the input. It is an internal guard around rcgen parameter construction during per-host leaf cert issuance.

Solutions

  1. Inspect the wrapped rcgen error for the rejected parameter (host name or IP SAN)
  2. Validate the target host string before attempting certificate issuance
  3. Report a bug if a well-formed hostname or IP still fails params construction
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at codex-rs/network-proxy/src/certs.rs:126 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/64642ad400e803aa. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/network-proxy/src/certs.rs:126

                .with_no_client_auth()
                .with_single_cert(vec![cert], key)
                .context("failed to build rustls server config")?;
        server_config.alpn_protocols = vec![
            ApplicationProtocol::HTTP_2.as_bytes().to_vec(),
            ApplicationProtocol::HTTP_11.as_bytes().to_vec(),
        ];

        Ok(TlsAcceptorData::from(server_config))
    }
}

fn issue_host_certificate_pem(
    host: &str,
    issuer: &Issuer<'_, KeyPair>,
) -> Result<(String, String)> {
    let mut params = if let Ok(ip) = host.parse::<IpAddr>() {
        let mut params = CertificateParams::new(Vec::new())
            .map_err(|err| anyhow!("failed to create cert params: {err}"))?;
        params.subject_alt_names.push(SanType::IpAddress(ip));
        params
    } else {
        CertificateParams::new(vec![host.to_string()])
            .map_err(|err| anyhow!("failed to create cert params: {err}"))?
    };

    params.extended_key_usages = vec![ExtendedKeyUsagePurpose::ServerAuth];
    params.key_usages = vec![
        KeyUsagePurpose::DigitalSignature,
        KeyUsagePurpose::KeyEncipherment,
    ];

    let key_pair = KeyPair::generate_for(&PKCS_ECDSA_P256_SHA256)
        .map_err(|err| anyhow!("failed to generate host key pair: {err}"))?;
    let cert = params
        .signed_by(&key_pair, issuer)
        .map_err(|err| anyhow!("failed to sign host cert: {err}"))?;

View on GitHub (pinned to 339751715c)