Hmbown/CodeWhale · error
Runtime event file changed
Error message
Runtime event file changed: {} What it means
The runtime verifies that a runtime event file has not been swapped underneath it by comparing stable file identities (device/inode via runtime_store_file_identity) between two file handles. If the identities differ, `ensure!` throws this error naming the path. It protects against reading a rewritten/replaced file mid-operation, which would yield inconsistent event data.
Solutions
- Reopen the event file and retry the read against the current file
- Ensure no other process is rotating or replacing the runtime event store while the app runs
- Run only one Codewhale runtime instance against the same data directory
Defensive patterns
Strategy: retry
Validate before calling
// detect a replaced event file before reading
let id_before = file_identity(path)?;
// ... use file ...
if file_identity(path)? != id_before { reopen_and_retry(path)?; } Try / catch
match read_runtime_events(path).await {
Err(e) if e.to_string().starts_with("Runtime event file changed") => {
let f = reopen(path)?; // re-read against the current file
read_runtime_events_from(f).await
}
other => other,
} Prevention
- Run only one runtime instance per data directory
- Do not rotate/truncate runtime event files while the app is running
- Exclude the runtime store directory from external cleanup jobs
When it happens
Trigger: Comparing first/second file handles for a runtime event store path where the file was replaced (deleted and recreated, renamed over, or recreated after rotation) between the two opens.
Common situations: Another process or an external log rotation replaced the runtime event file; a cleanup script truncated/recreated the store; two runtime instances writing the same path; filesystem copy that changed the inode.
Understand the failure class
Background: Checksum mismatch errors: "checksum verification failed", "digest mismatch", "expected vs actual checksum" — what they mean and how to fix them — this error's family across 41 libraries.
Related errors
- Fleet artifact grew while being read
- Fleet artifact size changed
- Fleet artifact size changed while being read
- A saved trace identifier collided. Try saving again.
- a window change is already in progress
AI-assisted analysis of Hmbown/CodeWhale@433685b202 (2026-09-15).
Data as JSON: /api/errors/552ebcf30de0d03c.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/runtime_threads.rs:12863
u64::from(info.dwVolumeSerialNumber),
(u64::from(info.nFileIndexHigh) << 32) | u64::from(info.nFileIndexLow),
))
}
#[cfg(all(not(unix), not(windows)))]
fn runtime_store_file_identity(file: &File) -> Result<(u64, u64)> {
anyhow::ensure!(file.metadata()?.is_file(), "must be a regular file");
Ok((0, 0))
}
fn validate_same_runtime_store_file_handles(
first: &File,
second: &File,
path: &Path,
) -> Result<()> {
let first = runtime_store_file_identity(first)?;
let second = runtime_store_file_identity(second)?;
anyhow::ensure!(
first == second,
"Runtime event file changed: {}",
path.display()
);
Ok(())
}
fn wait_for_event_lock(started: Instant, timeout: Duration) -> Result<()> {
let elapsed = started.elapsed();
if elapsed >= timeout {
return Err(anyhow!(RuntimeEventLockTimeout(timeout)));
}
std::thread::sleep(EVENT_TRANSACTION_LOCK_POLL.min(timeout - elapsed));
Ok(())
}
fn rollback_failed_event_append_handle(rollback_file: &File, original_len: u64) -> Result<()> {
rollback_fileView on GitHub (pinned to 433685b202)