zeroclaw-labs/zeroclaw · error · anyhow::Error

MCP server ` `: CA certificate file ` ` contained no…

Error message

MCP server `{}`: CA certificate file `{}` contained no certificates

What it means

reqwest::Certificate::from_pem_bundle parsed the CA file successfully but the bundle contained zero certificates (e.g. an empty file or one holding only non-certificate PEM blocks). The TLS config would silently verify nothing, so the transport refuses it.

Solutions

  1. Provide a CA certificate file containing at least one valid PEM certificate.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/zeroclaw-tools/src/mcp_transport.rs:206 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23). Data as JSON: /api/errors/a67a7f8aca535495. Report an issue: GitHub.

Appendix: source

Thrown at crates/zeroclaw-tools/src/mcp_transport.rs:206

        }));

        if !std::path::Path::new(path).is_absolute() {
            bail!(
                "MCP server `{}`: TLS CA certificate path must be absolute: `{}`",
                config.name,
                path
            );
        }

        let pem = load_tls_ca_pem(config, path)?;
        let certificates = reqwest::Certificate::from_pem_bundle(&pem).with_context(|| {
            format!(
                "MCP server `{}`: invalid PEM CA certificate at `{}`",
                config.name, path
            )
        })?;
        if certificates.is_empty() {
            bail!(
                "MCP server `{}`: CA certificate file `{}` contained no certificates",
                config.name,
                path
            );
        }
        for certificate in certificates {
            builder = builder.add_root_certificate(certificate);
        }
    }

    builder.build().with_context(|| {
        format!(
            "failed to build HTTP client for MCP server `{}`",
            config.name
        )
    })
}

View on GitHub (pinned to 88bb9c8533)