BoundaryML/baml · warning

BAML_PROFILE_DIR points at {}, which is not a `.baml/profile

Error message

BAML_PROFILE_DIR points at {}, which is not a `.baml/profiles-v1` store; remove it manually

What it means

baml's profile cleanup deliberately refuses any root not shaped `.../.baml/profiles-v1`, so it will not delete an arbitrary directory pointed to by BAML_PROFILE_DIR. When cleanup returns InvalidRoot and BAML_PROFILE_DIR is set, this error tells you to remove that directory manually.

Source

Thrown at baml_language/crates/baml_cli/src/clean_command.rs:44

        match bex_events::prof::backend::clean_profiles_v1(&profiles_root) {
            Ok(removed) => {
                let reporter = crate::reporter::Reporter::new();
                reporter.status(
                    if removed { "Removed" } else { "Clean" },
                    profiles_root.display().to_string(),
                );
                Ok(crate::ExitCode::Success)
            }
            Err(bex_events::prof::backend::CleanProfilesError::InUse) => {
                bail!("profiling store is in use: {}", profiles_root.display())
            }
            // Cleanup refuses any root not shaped `.../.baml/profiles-v1`,
            // so it cannot delete an arbitrary BAML_PROFILE_DIR. Say so
            // instead of surfacing the bare `InvalidRoot`.
            Err(bex_events::prof::backend::CleanProfilesError::InvalidRoot)
                if std::env::var_os("BAML_PROFILE_DIR").is_some() =>
            {
                bail!(
                    "BAML_PROFILE_DIR points at {}, which is not a `.baml/profiles-v1` store; \
                     remove it manually",
                    profiles_root.display()
                )
            }
            Err(error) => Err(anyhow::Error::new(error).context(format!(
                "failed to clean segmented profiler data at {}",
                profiles_root.display()
            ))),
        }
    }
}

View on GitHub (pinned to bd85ce9dee)

Solutions

  1. Manually delete the directory: rm -rf "$BAML_PROFILE_DIR" (verify contents first).
  2. Unset BAML_PROFILE_DIR and run `baml clean` so it operates on the default `.baml/profiles-v1` store.
  3. Point BAML_PROFILE_DIR at a properly-shaped `<something>/.baml/profiles-v1` directory if you want it managed by clean.

Example fix

# before
BAML_PROFILE_DIR=/tmp/my-profiles baml clean  # refuses
# after
rm -rf /tmp/my-profiles
unset BAML_PROFILE_DIR && baml clean
Defensive patterns

Strategy: validation

Validate before calling

# guard before running clean with a custom profile dir
[ -n "$BAML_PROFILE_DIR" ] && [[ "$BAML_PROFILE_DIR" == *".baml/profiles-v1" ]] || echo "BAML_PROFILE_DIR must end in .baml/profiles-v1; clean will refuse it"

Prevention

When it happens

Trigger: Running `baml clean` with BAML_PROFILE_DIR set to a path that is not a `.baml/profiles-v1` store, so CleanProfilesError::InvalidRoot is returned and matched by the BAML_PROFILE_DIR guard.

Common situations: Pointing BAML_PROFILE_DIR at a custom/experimental location (or a typo'd path) and later trying to clean it; older profile store layouts from previous baml versions left behind.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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