BoundaryML/baml · error

VSIX file was not created at expected location

Error message

VSIX file was not created at expected location

What it means

After curl reports success, download_vsix double-checks that the VSIX file actually exists at the expected path; if not, it bails with this message. This catches cases where curl exited 0 but wrote the file elsewhere (e.g. -o target path unwritable, path resolution issues).

Source

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

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);
        return;
    }

    let cursor_rules_file = cursor_rules_dir.join("baml.mdc");

View on GitHub (pinned to bd85ce9dee)

Solutions

  1. Check the destination/temp directory exists and is writable (ls the parent directory, check permissions).
  2. Run the curl command manually with the same arguments and inspect where the file lands.
  3. Free disk space if the volume is full.
  4. Install the VSIX manually via `code --install-extension <file>.vsix` as a workaround.

Example fix

// before
baml init  // fails: VSIX not created in /tmp
// after
TMPDIR=/var/tmp baml init  // use a writable temp dir
Defensive patterns

Strategy: validation

Validate before calling

# ensure temp dir is writable before init
touch "$TMPDIR/.write_test" && rm "$TMPDIR/.write_test"

Try / catch

catch (e) {
  if (String(e.message).includes('VSIX file was not created')) {
    // check TMPDIR/disk space, then install extension manually
  }
}

Prevention

When it happens

Trigger: install_extension_manually -> download_vsix when `output.status.success()` is true but `vsix_path.exists()` returns false — target directory missing/unwritable or path mapping mismatch.

Common situations: Temp directory permission problems, unusual --dest configurations, sandboxed environments where the temp path isn't visible after the subprocess finishes, disk full with curl silently failing.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


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