BoundaryML/baml · info · RegistryLeaseError

tests have not been collected for this build yet

Error message

tests have not been collected for this build yet

What it means

This is `RegistryLeaseError::NoRegistry`. It means test collection has not produced a test registry for the requested build generation yet. The lease path distinguishes this from `NeedsCurrentBuild`: the engine is current, but collection simply has not completed (or has not started) for this generation.

Source

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

    /// registry object, and results computed against the old one are stale.
    collection_epoch: u64,
    pub engine: Arc<BexEngine>,
    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,

View on GitHub (pinned to bd85ce9dee)

Solutions

  1. Wait for test collection for the current generation to complete, then retry the lease request
  2. Trigger collection explicitly if it is lazily scheduled and has not started
  3. Check collection logs for a failed/crashed collection run
  4. Retry the request after receiving a collection-completed notification

Example fix

// before: immediate lease after rebuild
let lease = registry_lease(&state, gen)?;

// after: wait for collection to produce the registry
match registry_lease(&state, gen) {
    Ok(l) => l,
    Err(RegistryLeaseError::NoRegistry) => {
        collection_complete_rx.await;
        registry_lease(&state, gen)?
    }
    _ => return,
}
Defensive patterns

Strategy: retry

Validate before calling

if !collection_completed_for(gen) { schedule_collection_and_wait(gen); }

Try / catch

match registry_lease(&state, gen) {
    Ok(l) => l,
    Err(RegistryLeaseError::NoRegistry) => { await_collection(gen); retry(); }
}

Prevention

When it happens

Trigger: Calling `registry_lease` for the current generation before the test collector has finished producing a registry for that generation; requesting tests immediately after a rebuild before collection runs.

Common situations: Triggering test discovery right after the engine finishes rebuilding, when the collection task is still in flight; a collection run that crashed leaving no registry for the generation.

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/d28039ea564b4b75. Report an issue: GitHub.