Hmbown/CodeWhale · error · RuntimeEventLockTimeout

Runtime event lock timed out after {:?}

Error message

Runtime event lock timed out after {:?}

What it means

Raised by wait_for_event_lock when the elapsed time since started already meets or exceeds the lock timeout before the next retry sleep: the Runtime event-file lock could not be acquired within the budget (RuntimeEventLockTimeout). It means contention on the event lock persisted longer than the configured EVENT_TRAN... sleep/timeout window allows.

Source

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

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
        .set_len(original_len)
        .context("Failed to roll back Runtime event")?;
    rollback_file
        .sync_all()
        .context("Failed to sync Runtime event rollback")
}

fn reject_symlinked_store_dir(path: &Path) -> Result<()> {
    let Ok(metadata) = fs::symlink_metadata(path) else {
        return Ok(());
    };

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Find the holder of the event lock — usually another Codewhale process or a stuck writer — and let it finish or terminate it
  2. Retry the operation once the contention clears
  3. If this recurs, increase the lock timeout or reduce concurrent runtimes sharing the same event file
Defensive patterns

Strategy: retry

When it happens

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

Common situations: See trigger scenarios.

Understand the failure class


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