{"record":{"id":"6b3ea0e8848f15ca","repo":"Hmbown/CodeWhale","slug":"exceeds-the-tombstone-size-limit","errorCode":null,"errorMessage":"{} exceeds the tombstone size limit","messagePattern":"(.+?) exceeds the tombstone size limit","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/telemetry/src/buffer.rs","lineNumber":123,"sourceCode":"/// Read the exact tombstone generation, or `None` when collection has never\n/// been disabled in this home.\npub(crate) fn tombstone_generation(root: &Path) -> Result<Option<TombstoneGeneration>> {\n    let path = tombstone_path(root);\n    let file = match File::open(&path) {\n        Ok(file) => file,\n        Err(error) if error.kind() == std::io::ErrorKind::NotFound => return Ok(None),\n        Err(error) => {\n            return Err(\n                anyhow::Error::new(error).context(format!(\"failed to open {}\", path.display()))\n            );\n        }\n    };\n    let mut bytes = Vec::new();\n    file.take(MAX_TOMBSTONE_BYTES + 1)\n        .read_to_end(&mut bytes)\n        .with_context(|| format!(\"failed to read {}\", path.display()))?;\n    if bytes.len() as u64 > MAX_TOMBSTONE_BYTES {\n        anyhow::bail!(\"{} exceeds the tombstone size limit\", path.display());\n    }\n    Ok(Some(TombstoneGeneration(bytes)))\n}\n\n/// Create the telemetry directory `0700`, if it is missing.\npub fn ensure_dir(root: &Path) -> Result<()> {\n    if root.is_dir() {\n        return Ok(());\n    }\n    let mut builder = DirBuilder::new();\n    builder.recursive(true);\n    #[cfg(unix)]\n    {\n        use std::os::unix::fs::DirBuilderExt as _;\n        builder.mode(0o700);\n    }\n    builder\n        .create(root)","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/telemetry/src/buffer.rs#L105-L141","documentation":"Tombstone generation reads the telemetry tombstone file (evidence that telemetry was wiped) but caps how much it reads at MAX_TOMBSTONE_BYTES. If the file is larger than the limit, it bails with this error instead of returning a generation, because an oversized tombstone means something unexpected is in the telemetry directory.","triggerScenarios":"arm() or wipe() calls tombstone_generation(root) while $CODEWHALE_HOME/telemetry/tombstone (or the equivalent file) is bigger than MAX_TOMBSTONE_BYTES.","commonSituations":"User or a script wrote arbitrary large data to the tombstone path; corrupted/concatenated tombstone from a crashed writer; filesystem with wrong file placed at the telemetry path; tampering test fixtures.","solutions":["Inspect the file size: ls -l $CODEWHALE_HOME/telemetry/ and identify the oversized tombstone.","Remove or truncate the tombstone (rm or truncate) if its content isn't needed, then retry the operation.","Re-run the wipe flow so a fresh, valid tombstone is generated.","Ensure nothing else writes into the telemetry directory (check cron/scripts pointing there)."],"exampleFix":"// before: stale oversized tombstone blocks arming\narm(root, observed_generation, || true)?;\n// after: clear an invalid tombstone first\nlet tomb = telemetry::buffer::tombstone_path(root);\nif fs::metadata(&tomb).map(|m| m.len() > MAX_TOMBSTONE_BYTES).unwrap_or(false) {\n    fs::remove_file(&tomb)?;\n}\narm(root, observed_generation, || true)?;","handlingStrategy":"validation","validationCode":"fn tombstone_is_valid(root: &Path) -> bool {\n    std::fs::metadata(telemetry::buffer::tombstone_path(root))\n        .map(|m| m.len() <= MAX_TOMBSTONE_BYTES)\n        .unwrap_or(true)\n}","typeGuard":"fn fits_tombstone_limit(len: u64) -> bool { len <= MAX_TOMBSTONE_BYTES }","tryCatchPattern":"match telemetry::buffer::wipe(root) {\n    Err(e) if e.to_string().contains(\"tombstone size limit\") => {\n        let _ = std::fs::remove_file(telemetry::buffer::tombstone_path(root));\n        telemetry::buffer::wipe(root)?; // regenerate a valid tombstone\n    }\n    r => r?,\n}","preventionTips":["Never write other files into the telemetry directory","Verify tombstone size after wipe/generation","Treat oversized telemetry files as corruption and regenerate","Monitor $CODEWHALE_HOME/telemetry for unexpected content"],"tags":["telemetry","file-size","limit"],"backgroundTag":"file-size-limit-exceeded","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}