BoundaryML/baml · error

Failed to download extension

Error message

Failed to download extension: {}

What it means

download_vsix in `baml-cli init` shells out to `curl -L -o <vsix_path> <url>` to fetch the BAML editor extension as a VSIX file. If curl exits with a non-zero status, the collected stderr is surfaced as this error. It indicates the extension download failed at the HTTP/network level.

Solutions

  1. Check the stderr embedded in the error message for the actual curl failure (DNS, 404, TLS, proxy).
  2. Test the download manually with `curl -L -o /tmp/baml.vsix <url>` using the URL from the error context.
  3. Ensure network/proxy access: set HTTPS_PROXY/HTTP_PROXY or add the marketplace to your proxy allowlist.
  4. Install the extension manually: download the VSIX in a browser and run `code --install-extension baml.vsix` instead of the manual path.

Example fix

// before (fails behind proxy)
curl -L -o baml.vsix https://marketplace.../baml.vsix
// after
export HTTPS_PROXY=http://proxy.corp:8080
baml init
Defensive patterns

Strategy: retry

Validate before calling

# preflight connectivity to the marketplace host
curl -fsIL "$URL" >/dev/null || echo 'marketplace unreachable'

Try / catch

catch (e) {
  if (String(e.message).includes('Failed to download extension')) {
    // inspect embedded curl stderr, fix proxy/network, retry once
  }
}

Prevention

When it happens

Trigger: install_extension_manually -> download_vsix when `Command::new("curl")...output()` returns a failed status: bad URL, no network access, proxy blocking GitHub, 404 from marketplace, TLS issues.

Common situations: Corporate proxy/firewall blocking the marketplace domain, offline CI, expired marketplace URL after an extension version change, missing CA certificates.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at engine/baml-runtime/src/cli/init.rs:244

    } else {
        install_extension_manually("cursor");
    }
}

fn download_vsix(url: &str, filename: &str) -> Result<PathBuf> {
    let temp_dir = std::env::temp_dir();
    let vsix_path = temp_dir.join(filename);

    baml_log::info!("Downloading BAML extension to: {}", vsix_path.display());

    // Use curl to download the file
    let curl_args = vec!["-L", "-o", vsix_path.to_str().unwrap(), url];

    let output = Command::new("curl").args(&curl_args).output()?;

    if !output.status.success() {
        let stderr = String::from_utf8_lossy(&output.stderr);
        anyhow::bail!("Failed to download extension: {}", stderr);
    }

    // Verify the file was downloaded
    if !vsix_path.exists() {
        anyhow::bail!("VSIX file was not created at expected location");
    }

    Ok(vsix_path)
}

const BAML_MDC: &str = include_str!("initial_project/baml.mdc");

fn copy_cursor_rules(dest_path: &std::path::Path) {
    let cursor_rules_dir = dest_path.join(".cursor").join("rules");

    // Create the .cursor/rules directory if it doesn't exist
    if let Err(e) = fs::create_dir_all(&cursor_rules_dir) {
        baml_log::info!("Could not create .cursor/rules directory: {}", e);

View on GitHub (pinned to bd85ce9dee)