BoundaryML/baml · error

Failed to download asset: {e}

Error message

Failed to download asset: {e}

What it means

get_playground_dist downloads the web-panel asset archive over HTTPS via reqwest; when the request itself fails (connection, DNS, TLS, timeout), it wraps the reqwest error into "Failed to download asset: {e}". This happens before checksum verification and extraction.

Source

Thrown at engine/playground-server/src/server.rs:224

                extract_root.display()
            )
        })?;
    }
    std::fs::create_dir_all(&extract_root).with_context(|| {
        format!(
            "Failed to create extraction directory: {}",
            extract_root.display()
        )
    })?;

    // Download the tar.gz asset
    tracing::info!("Downloading web-panel asset from: {}", download_url);
    let resp = client
        .get(download_url)
        .header("User-Agent", "baml-playground-server")
        .send()
        .await
        .map_err(|e| anyhow::anyhow!("Failed to download asset: {e}"))?;
    let bytes = resp.bytes().await?;

    // Verify SHA256 checksum
    verify_sha256_checksum(&bytes, checksum_url, &client).await?;

    // Extract the verified archive
    let tar = GzDecoder::new(Cursor::new(bytes));
    let mut archive = Archive::new(tar);
    archive
        .unpack(&extract_root)
        .with_context(|| format!("Failed to extract archive to: {}", extract_root.display()))?;

    // Return the path to the actual dist directory if it exists, else the extraction root
    if dist_dir.exists() && dist_dir.read_dir()?.next().is_some() {
        Ok(dist_dir.to_string_lossy().to_string())
    } else {
        Ok(extract_root.to_string_lossy().to_string())
    }

View on GitHub (pinned to bd85ce9dee)

Solutions

  1. Check network connectivity and proxy settings (HTTPS_PROXY / HTTP_PROXY env vars) on the host.
  2. Confirm the download_url printed in the log ('Downloading web-panel asset from: ...') is reachable with curl and returns 200.
  3. Retry with a longer reqwest timeout if the failure is a timeout, or pre-place the extracted dist under ~/.baml/playground so download is skipped.

Example fix

// before
let client = reqwest::Client::new();
// after: add proxy support and timeout
let client = reqwest::Client::builder()
    .timeout(std::time::Duration::from_secs(60))
    .build()?;
Defensive patterns

Strategy: retry

Validate before calling

curl -fsSI "$ASSET_URL" >/dev/null && echo reachable || echo unreachable

Try / catch

match get_playground_dist().await {
    Err(e) if e.to_string().starts_with("Failed to download asset") => retry_with_backoff(3),
    other => other?,
}

Prevention

When it happens

Trigger: client.get(download_url).send().await returns Err — network unreachable, DNS failure, TLS error, request timeout, or invalid URL scheme when fetching the playground dist asset.

Common situations: Offline or air-gapped environments trying to fetch the playground on demand; corporate proxies blocking the download URL; GitHub release asset URL changed/renamed; DNS misconfiguration in containers.

Related errors


AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12). Data as JSON: /api/errors/53a5532978d57c75. Report an issue: GitHub.