{"record":{"id":"552ebcf30de0d03c","repo":"Hmbown/CodeWhale","slug":"runtime-event-file-changed","errorCode":null,"errorMessage":"Runtime event file changed: {}","messagePattern":"Runtime event file changed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/runtime_threads.rs","lineNumber":9001,"sourceCode":"        u64::from(info.dwVolumeSerialNumber),\n        (u64::from(info.nFileIndexHigh) << 32) | u64::from(info.nFileIndexLow),\n    ))\n}\n\n#[cfg(all(not(unix), not(windows)))]\nfn runtime_store_file_identity(file: &File) -> Result<(u64, u64)> {\n    anyhow::ensure!(file.metadata()?.is_file(), \"must be a regular file\");\n    Ok((0, 0))\n}\n\nfn validate_same_runtime_store_file_handles(\n    first: &File,\n    second: &File,\n    path: &Path,\n) -> Result<()> {\n    let first = runtime_store_file_identity(first)?;\n    let second = runtime_store_file_identity(second)?;\n    anyhow::ensure!(\n        first == second,\n        \"Runtime event file changed: {}\",\n        path.display()\n    );\n    Ok(())\n}\n\nfn wait_for_event_lock(started: Instant, timeout: Duration) -> Result<()> {\n    let elapsed = started.elapsed();\n    if elapsed >= timeout {\n        return Err(anyhow!(RuntimeEventLockTimeout(timeout)));\n    }\n    std::thread::sleep(EVENT_TRANSACTION_LOCK_POLL.min(timeout - elapsed));\n    Ok(())\n}\n\nfn rollback_failed_event_append_handle(rollback_file: &File, original_len: u64) -> Result<()> {\n    rollback_file","sourceCodeStart":8983,"sourceCodeEnd":9019,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/runtime_threads.rs#L8983-L9019","documentation":"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.","triggerScenarios":"Thrown at crates/tui/src/runtime_threads.rs:9001 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Identify what is rewriting the runtime event/store file concurrently (another Codewhale process, a sync agent) and stop it","Reopen the store from scratch so both handles refer to the current file generation","If the replacement was intentional (migration), restart the runtime after it completes"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}