sigoden/dufs · error · anyhow::Error

No supported certificate in file

Error message

No supported certificate in file `{}`

What it means

Raised in load_certs (tls feature) at server startup: the PEM certificate file was readable, but after parsing every PEM block, zero certificates were extracted — meaning the file contains no supported certificate entries (e.g. it holds only a private key, or is empty/garbage). The server cannot build a TLS config without at least one certificate, so startup fails via serve.

Solutions

  1. Point --tls-cert at a file that actually contains a PEM certificate (-----BEGIN CERTIFICATE----- blocks)
  2. If the file only holds the private key, supply it via the key option and use a separate certificate file
  3. Regenerate or re-export the certificate in PEM format
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/utils.rs:67 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of sigoden/dufs@fe7fd564f8 (2026-09-09). Data as JSON: /api/errors/7d5cc255db980981. Report an issue: GitHub.

Appendix: source

Thrown at src/utils.rs:67

#[cfg(feature = "tls")]
pub fn load_certs<T: AsRef<Path>>(file_name: T) -> Result<Vec<CertificateDer<'static>>> {
    let mut certs = vec![];
    for cert in CertificateDer::pem_file_iter(file_name.as_ref()).with_context(|| {
        format!(
            "Failed to load cert file at `{}`",
            file_name.as_ref().display()
        )
    })? {
        let cert = cert.with_context(|| {
            format!(
                "Invalid certificate data in file `{}`",
                file_name.as_ref().display()
            )
        })?;
        certs.push(cert)
    }
    if certs.is_empty() {
        anyhow::bail!(
            "No supported certificate in file `{}`",
            file_name.as_ref().display()
        );
    }
    Ok(certs)
}

// Load private key from file.
#[cfg(feature = "tls")]
pub fn load_private_key<T: AsRef<Path>>(file_name: T) -> Result<PrivateKeyDer<'static>> {
    PrivateKeyDer::from_pem_file(file_name.as_ref()).with_context(|| {
        format!(
            "Failed to load key file at `{}`",
            file_name.as_ref().display()
        )
    })
}

View on GitHub (pinned to fe7fd564f8)