Hmbown/CodeWhale · error

Runtime event file changed: {}

Error message

Runtime event file changed: {}

What it means

Guard in validate_same_runtime_store_file_handles: the (device, inode) or (volume-serial, file-index) identity of two handles opened for the same path differs. This is the TOCTOU detector — between opening the two handles, the file at that path was replaced (e.g. an atomic rename by another process), so the runtime refuses to continue with mismatched handles.

Source

Thrown at crates/tui/src/runtime_threads.rs:9001

        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_file

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Identify what is rewriting the runtime event/store file concurrently (another Codewhale process, a sync agent) and stop it
  2. Reopen the store from scratch so both handles refer to the current file generation
  3. If the replacement was intentional (migration), restart the runtime after it completes
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/tui/src/runtime_threads.rs:9001 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/552ebcf30de0d03c. Report an issue: GitHub.