BoundaryML/baml · error

{} sets default.selector to a relative path ({selector}), wh

Error message

{} sets default.selector to a relative path ({selector}), which would depend on the current directory.
Use an absolute path, or run: baml toolchain use <path>

What it means

Fires while resolving the active toolchain selector: the machine-global config (~/.baml/config) has default.selector set to a relative filesystem path. Global defaults are resolved at invocation time, so a relative path would pick a different binary depending on the cwd — the wrapper refuses rather than run an unpredictable toolchain. The selector resolution order is env var > project baml.toml > global config; only the global-config branch can produce this error.

Source

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

            return Ok(ResolvedSelector {
                selector: normalize_selector(value.trim(), &env::current_dir()?),
                source: SelectorSource::Env,
            });
        }
    }
    if let Some((path, selector)) = project_toolchain_selector()? {
        return Ok(ResolvedSelector {
            selector,
            source: SelectorSource::Project(path),
        });
    }
    let config = read_config();
    let selector = config.default.selector.trim();
    if !selector.is_empty() {
        // A machine-global default resolved against cwd would run a different
        // binary from each directory, so it has to stand on its own.
        if is_path_selector(selector) && !is_cwd_independent(selector) {
            return Err(anyhow!(
                "{} sets default.selector to a relative path ({selector}), which would depend on the current directory.\nUse an absolute path, or run: baml toolchain use <path>",
                config_path().display()
            ));
        }
        return Ok(ResolvedSelector {
            selector: normalize_selector(selector, &env::current_dir()?),
            source: SelectorSource::Config,
        });
    }
    Ok(ResolvedSelector {
        selector: "canary".to_string(),
        source: SelectorSource::Fallback,
    })
}

fn project_toolchain_selector() -> Result<Option<(PathBuf, String)>> {
    let mut dir = env::current_dir()?;
    let home = env::var_os("HOME").map(PathBuf::from);

View on GitHub (pinned to bd85ce9dee)

Solutions

  1. Edit the global config's default.selector to an absolute path
  2. Or register the local build properly with `baml toolchain use <absolute-path>`
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at baml_language/crates/baml/src/main.rs:530 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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