BoundaryML/baml · info · RegistryLeaseError

the project has no tests

Error message

the project has no tests

What it means

This is `RegistryLeaseError::NoTests`. Collection for the current generation completed successfully, but the project contains no tests at all. It is a normal, expected outcome rather than a failure — it tells the caller there is simply nothing to run.

Source

Thrown at baml_language/crates/baml_lsp_server/src/engine.rs:140

    pub handle: Handle,
    pub cancel: sys_types::CancellationToken,
    /// One mutation owner per installed registry: expansions mutate the
    /// registry heap object in place, so they serialize on this.
    pub expansion_gate: Arc<tokio::sync::Mutex<()>>,
}

/// Why a registry lease could not be produced.
#[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error)]
pub enum RegistryLeaseError {
    /// The requested generation is not the installed one, or the installed
    /// engine no longer matches current source.
    #[error("engine is not current with the latest sources; wait for the rebuild")]
    NeedsCurrentBuild,
    /// Collection has not produced a registry for this generation yet.
    #[error("tests have not been collected for this build yet")]
    NoRegistry,
    /// Collection completed and the project has no tests.
    #[error("the project has no tests")]
    NoTests,
}

/// Coherent runtime identity for one workspace root. All fields swap
/// together under one lock.
struct RuntimeState {
    installed: Option<InstalledEngine>,
    /// Allocator for engine generations; only a winning commit consumes one.
    next_generation: u64,
    /// Cancels project-derived work (test collection, expansion) when source
    /// moves or a commit supersedes it. Never cancels run-owned tokens.
    derived_cancel: sys_types::CancellationToken,
    /// Fences test-collection installs so two collections on one engine
    /// generation cannot complete out of order.
    collection_epoch: u64,
    registry: Option<InstalledRegistry>,
}

View on GitHub (pinned to bd85ce9dee)

Solutions

  1. Add tests to the project if tests are expected
  2. Treat this as a success case and surface 'no tests found' in the UI instead of an error
  3. Verify you are in the workspace root you intend — tests may live in a different root/folder
  4. Check collection included your host folders (`add_host_folder`) if tests live outside the default root

Example fix

// before: treating NoTests as failure
let lease = registry_lease(&state, gen)?;

// after: handle the empty case gracefully
match registry_lease(&state, gen) {
    Ok(l) => run_tests(l),
    Err(RegistryLeaseError::NoTests) => report_no_tests(),
    Err(e) => return Err(e.into()),
}
Defensive patterns

Strategy: fallback

Validate before calling

if collected_test_count(gen) == 0 { show_empty_state(); }

Try / catch

match registry_lease(&state, gen) {
    Ok(l) => run_tests(l),
    Err(RegistryLeaseError::NoTests) => show_no_tests_ui(),
    Err(e) => return Err(e.into()),
}

Prevention

When it happens

Trigger: Requesting a test registry lease after collection finished on a project whose sources define no tests; running test discovery on an empty or test-free workspace.

Common situations: Opening a project with only functions/builders and no test blocks, then invoking the run-tests command; a newly created empty project.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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