{"record":{"id":"4162f9b8ad3b970d","repo":"BoundaryML/baml","slug":"transport-error-0","errorCode":null,"errorMessage":"Transport error: {0}","messagePattern":"Transport error: (.+?)","errorType":"exception","errorClass":"ApiError","httpStatus":null,"severity":"error","filePath":"engine/baml-runtime/src/tracingv2/publisher/publisher.rs","lineNumber":192,"sourceCode":"                    body: body_str,\n                });\n            }\n\n            // D) happy path: 2xx → attempt to parse into T\n            serde_json::from_slice::<TEndpoint::Response<'resp>>(&bytes)\n                .map_err(ApiError::Deserialize)\n        };\n\n        match timeout(timeout_duration, fut).await {\n            Ok(res) => res,\n            Err(_) => Err(ApiError::Timeout(timeout_duration)),\n        }\n    }\n}\n\n#[derive(thiserror::Error, Debug)]\npub enum ApiError {\n    #[error(\"Transport error: {0}\")]\n    Transport(reqwest::Error),\n    #[error(\"HTTP error: {status} {body}\")]\n    Http {\n        status: reqwest::StatusCode,\n        body: String,\n    },\n    #[error(\"Failed to deserialize response: {0}\")]\n    Deserialize(serde_json::Error),\n    #[error(\"Request timed out after {0:?}\")]\n    Timeout(Duration),\n}\n\nimpl TypeLookup for RuntimeAST {\n    fn type_lookup(&self, name: &str) -> Option<Arc<baml_rpc::BamlTypeId>> {\n        self.ast.type_lookup(name)\n    }\n\n    fn function_lookup(&self, name: &str) -> Option<Arc<baml_rpc::ast::tops::BamlFunctionId>> {","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/baml-runtime/src/tracingv2/publisher/publisher.rs#L174-L210","documentation":"This is the Display message of ApiError::Transport in the BAML trace publisher. It wraps a reqwest::Error, meaning the HTTP request to the BAML cloud tracing API (used when publishing trace events or uploading BAML source) failed at the transport layer before a response was received: DNS resolution failure, TCP/TLS connect failure, or connection reset. The library throws it because the collector endpoint could not be reached at all.","triggerScenarios":"The reqwest client fails to send the request or receive any response: DNS failure for the collector host, network unreachable, TLS handshake failure, proxy misconfigured, or connection dropped mid-request while sending trace events to the BAML API.","commonSituations":"Running BAML in an offline/air-gapped CI environment, corporate firewall or proxy blocking the collector host, BAML_URL/BAML_SECRET pointing at a wrong or unreachable host, VPN disconnected, or DNS misconfiguration in containers/K8s.","solutions":["Verify network connectivity to the collector host (curl the URL from the same machine).","Check BAML_URL / endpoint env vars for typos or stale hosts.","Fix DNS/proxy settings (HTTPS_PROXY, corporate CA certs) in the runtime environment.","Enable retries/backoff for publishing, or disable trace export if telemetry is not required."],"exampleFix":"// before\nbaml_client.tracing.disable()\n// after (guarded, non-fatal publish)\nmatch publisher.publish(event) {\n    Err(ApiError::Transport(e)) => log::warn!(\"trace transport failed: {e}\"),\n    _ => {}\n}","handlingStrategy":"retry","validationCode":"// before enabling trace export\ncurl -sS -o /dev/null -w \"%{http_code}\" \"$BAML_URL/health\" || echo \"collector unreachable\"","typeGuard":"fn is_transport_err(e: &ApiError) -> bool { matches!(e, ApiError::Transport(_)) }","tryCatchPattern":"match publisher.publish(ev) {\n    Err(ApiError::Transport(e)) => { log::warn!(\"transport: {e}\"); retry_with_backoff(); }\n    Err(e) => log::error!(\"publish failed: {e}\"),\n    Ok(_) => {}\n}","preventionTips":["Check connectivity to the collector host in CI before enabling tracing","Set HTTPS_PROXY/CA bundle correctly in corporate environments","Use retries with exponential backoff for telemetry","Make trace publishing non-fatal (log and drop)"],"tags":["network","http","baml","tracing"],"backgroundTag":"network-request-failed","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}