BoundaryML/baml · warning · PrepareRunError
engine is not current with the latest sources; wait for the
Error message
engine is not current with the latest sources; wait for the rebuild
What it means
This error comes from `PrepareRunError::NeedsCurrentBuild` in the LSP server's engine module. It means a function run could not be launched because there is no engine installed yet, or the installed engine binary predates the current source files. The server deliberately refuses to run against a stale or missing engine instead of silently using a last-known-good build.
Source
Thrown at baml_language/crates/baml_lsp_server/src/engine.rs:94
receipt: CommitReceipt,
/// The engine this commit replaced, handed back for the caller to
/// shut down. Commits are owner-thread work and the owner is not a
/// tokio worker, so the runtime cannot spawn the drain itself — see
/// [`spawn_engine_shutdown`].
retired: Option<Arc<BexEngine>>,
},
/// The source revision advanced past the candidate; nothing changed and
/// the candidate was dropped quietly.
Superseded { current_revision: SourceRevision },
}
/// Why a run snapshot could not be produced. There is no `Busy`/`Broken`
/// axis anymore: reads are owner-linearized and panics never poison state.
#[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error)]
pub enum PrepareRunError {
/// No engine yet, or the installed engine predates the current source.
/// Runs never silently use a last-known-good engine.
#[error("engine is not current with the latest sources; wait for the rebuild")]
NeedsCurrentBuild,
}
/// Coherent snapshot for launching a function run.
#[derive(Clone)]
pub struct RunSnapshot {
pub generation: u64,
pub engine: Arc<BexEngine>,
}
/// Ticket for one test-collection attempt, captured atomically.
pub struct CollectionTicket {
pub generation: u64,
collection_epoch: u64,
pub engine: Arc<BexEngine>,
pub cancel: sys_types::CancellationToken,
}
View on GitHub (pinned to bd85ce9dee)
Solutions
- Wait for the engine rebuild to complete, then retry the run
- Trigger an explicit rebuild of the engine from the current sources
- Check the build output for failures — a stale engine usually means the latest build errored or is still in progress
- Verify the installed engine generation matches the current source generation before launching runs
Example fix
// before: immediately invoking run after an edit
let snapshot = prepare_run(&state, request)?;
// after: retry until the engine is current
match prepare_run(&state, request) {
Ok(snapshot) => snapshot,
Err(PrepareRunError::NeedsCurrentBuild) => {
schedule_retry_after_rebuild(request);
return;
}
} Defensive patterns
Strategy: retry
Validate before calling
// rust
fn engine_is_current(state: &State) -> bool { state.engine_generation() == state.source_generation() } Try / catch
match prepare_run(&state, req) {
Ok(s) => s,
Err(PrepareRunError::NeedsCurrentBuild) => { retry_after_rebuild(req); }
} Prevention
- Gate run requests on a rebuild-completed notification
- Never cache engine handles across source edits
- Surface build status in the UI before enabling run commands
When it happens
Trigger: Calling the run-snapshot preparation path (`prepare_run`) when no engine has been built yet, or when the engine was built before the latest edits to the sources, i.e. the installed engine generation does not match the current source state.
Common situations: Editing a .bml function and immediately trying to run it before the incremental rebuild finishes; a fresh checkout where the engine was never built; a build that failed leaving a stale engine binary installed.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- {0}
- Notification not supported: {0}
- Request not supported: {0}
- Failed to serialize request result: {0}
- no filesystem is attached to this server ({})
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/c83af0f38279aa55.
Report an issue: GitHub.