BoundaryML/baml · error

BAML toolchain {version} is not installed

Error message

BAML toolchain {version} is not installed

What it means

uninstall_toolchain checks that a managed toolchain directory exists under toolchains_dir() before removing it. If `toolchains_dir().join(version)` does not exist, this error reports the toolchain is not installed, preventing removal_dir_all from failing on a missing path.

Source

Thrown at baml_language/crates/baml/src/main.rs:1517

        println!("installed toolchains:");
        for version in installed {
            println!("  {version}");
        }
    }
    println!();
    println!("Remote versions were not checked.");
    println!("Run: baml toolchain status");
}

fn uninstall_toolchain(version: &str) -> Result<()> {
    if is_path_selector(version) {
        return Err(anyhow!(
            "{version} is a local path and is not managed by the wrapper, so there is nothing to uninstall.\nTo stop using it, select a managed toolchain instead.\nRun: baml toolchain use canary\nOr:  baml toolchain use nightly"
        ));
    }
    let dir = toolchains_dir().join(version);
    if !dir.exists() {
        return Err(anyhow!("BAML toolchain {version} is not installed"));
    }
    fs::remove_dir_all(dir)?;
    println!("uninstalled BAML toolchain {version}");
    Ok(())
}

#[cfg(any(not(feature = "self-update"), feature = "no-self-update"))]
fn self_update() -> Result<()> {
    Err(anyhow!(
        "self-update is disabled in this build.\nUpdate BAML with your package manager."
    ))
}

#[cfg(all(feature = "self-update", not(feature = "no-self-update")))]
fn self_update() -> Result<()> {
    let current = env::current_exe()?;
    let manifest = fetch_wrapper_manifest()?;
    let target = baml_release::release_host_target_triple()?;

View on GitHub (pinned to bd85ce9dee)

Solutions

  1. Run `baml toolchain status` (or list the toolchains directory) to see installed versions and use an exact installed version name.
  2. Treat this as a no-op if the toolchain was already removed and make your script idempotent.
  3. Install the version first if you expected it to exist: `baml toolchain install <version>`.

Example fix

// before
baml toolchain uninstall 0.209   # never installed / typo
// after
baml toolchain status
baml toolchain uninstall 0.209.0   # exact installed version
Defensive patterns

Strategy: validation

Validate before calling

const installed = execFileSync('baml', ['toolchain', 'status']).toString();
if (!installed.includes(version)) throw new Error(`${version} is not installed; nothing to uninstall`);

Try / catch

try {
  execFileSync('baml', ['toolchain', 'uninstall', version]);
} catch (e) {
  if (/is not installed/.test(e.stderr?.toString() ?? '')) {
    console.warn(`${version} already absent; treating as no-op`);
  }
}

Prevention

When it happens

Trigger: Running `baml toolchain uninstall <version>` where the directory toolchains_dir()/version does not exist — the version was never installed, already uninstalled, or the name is misspelled.

Common situations: Typos in the version string; uninstalling twice in a row; cleaning up versions after manually deleting the toolchains directory; checking with `baml toolchain status` for the actual installed set.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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