{"record":{"id":"d28039ea564b4b75","repo":"BoundaryML/baml","slug":"tests-have-not-been-collected-for-this-build-yet","errorCode":null,"errorMessage":"tests have not been collected for this build yet","messagePattern":"tests have not been collected for this build yet","errorType":"error_code","errorClass":"RegistryLeaseError","httpStatus":null,"severity":"info","filePath":"baml_language/crates/baml_lsp_server/src/engine.rs","lineNumber":137,"sourceCode":"    /// registry object, and results computed against the old one are stale.\n    collection_epoch: u64,\n    pub engine: Arc<BexEngine>,\n    pub handle: Handle,\n    pub cancel: sys_types::CancellationToken,\n    /// One mutation owner per installed registry: expansions mutate the\n    /// registry heap object in place, so they serialize on this.\n    pub expansion_gate: Arc<tokio::sync::Mutex<()>>,\n}\n\n/// Why a registry lease could not be produced.\n#[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error)]\npub enum RegistryLeaseError {\n    /// The requested generation is not the installed one, or the installed\n    /// engine no longer matches current source.\n    #[error(\"engine is not current with the latest sources; wait for the rebuild\")]\n    NeedsCurrentBuild,\n    /// Collection has not produced a registry for this generation yet.\n    #[error(\"tests have not been collected for this build yet\")]\n    NoRegistry,\n    /// Collection completed and the project has no tests.\n    #[error(\"the project has no tests\")]\n    NoTests,\n}\n\n/// Coherent runtime identity for one workspace root. All fields swap\n/// together under one lock.\nstruct RuntimeState {\n    installed: Option<InstalledEngine>,\n    /// Allocator for engine generations; only a winning commit consumes one.\n    next_generation: u64,\n    /// Cancels project-derived work (test collection, expansion) when source\n    /// moves or a commit supersedes it. Never cancels run-owned tokens.\n    derived_cancel: sys_types::CancellationToken,\n    /// Fences test-collection installs so two collections on one engine\n    /// generation cannot complete out of order.\n    collection_epoch: u64,","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/baml_lsp_server/src/engine.rs#L119-L155","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Wait for test collection for the current generation to complete, then retry the lease request","Trigger collection explicitly if it is lazily scheduled and has not started","Check collection logs for a failed/crashed collection run","Retry the request after receiving a collection-completed notification"],"exampleFix":"// before: immediate lease after rebuild\nlet lease = registry_lease(&state, gen)?;\n\n// after: wait for collection to produce the registry\nmatch registry_lease(&state, gen) {\n    Ok(l) => l,\n    Err(RegistryLeaseError::NoRegistry) => {\n        collection_complete_rx.await;\n        registry_lease(&state, gen)?\n    }\n    _ => return,\n}","handlingStrategy":"retry","validationCode":"if !collection_completed_for(gen) { schedule_collection_and_wait(gen); }","typeGuard":null,"tryCatchPattern":"match registry_lease(&state, gen) {\n    Ok(l) => l,\n    Err(RegistryLeaseError::NoRegistry) => { await_collection(gen); retry(); }\n}","preventionTips":["Subscribe to collection-completed events before requesting leases","Trigger collection eagerly after each rebuild","Monitor collection task health to catch crashed collections"],"tags":["lsp","rust","async","tests"],"backgroundTag":"empty-result-set","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}