{"record":{"id":"7b82818cc5965e96","repo":"BoundaryML/baml","slug":"the-project-has-no-tests","errorCode":null,"errorMessage":"the project has no tests","messagePattern":"the project has no tests","errorType":"error_code","errorClass":"RegistryLeaseError","httpStatus":null,"severity":"info","filePath":"baml_language/crates/baml_lsp_server/src/engine.rs","lineNumber":140,"sourceCode":"    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,\n    registry: Option<InstalledRegistry>,\n}\n","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/baml_lsp_server/src/engine.rs#L122-L158","documentation":"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.","triggerScenarios":"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.","commonSituations":"Opening a project with only functions/builders and no test blocks, then invoking the run-tests command; a newly created empty project.","solutions":["Add tests to the project if tests are expected","Treat this as a success case and surface 'no tests found' in the UI instead of an error","Verify you are in the workspace root you intend — tests may live in a different root/folder","Check collection included your host folders (`add_host_folder`) if tests live outside the default root"],"exampleFix":"// before: treating NoTests as failure\nlet lease = registry_lease(&state, gen)?;\n\n// after: handle the empty case gracefully\nmatch registry_lease(&state, gen) {\n    Ok(l) => run_tests(l),\n    Err(RegistryLeaseError::NoTests) => report_no_tests(),\n    Err(e) => return Err(e.into()),\n}","handlingStrategy":"fallback","validationCode":"if collected_test_count(gen) == 0 { show_empty_state(); }","typeGuard":null,"tryCatchPattern":"match registry_lease(&state, gen) {\n    Ok(l) => run_tests(l),\n    Err(RegistryLeaseError::NoTests) => show_no_tests_ui(),\n    Err(e) => return Err(e.into()),\n}","preventionTips":["Handle NoTests as a normal UI state, not a failure","Confirm the workspace root and host folders include your test files","Show a test-count summary after each collection"],"tags":["lsp","rust","tests","empty-state"],"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-14T11:17:12.474Z"}