{"record":{"id":"202f8418a44c8553","repo":"Hmbown/CodeWhale","slug":"continual-harness-state-has-entries-maximum","errorCode":null,"errorMessage":"continual harness state {} has {} entries; maximum is {MAX_ENTRIES}","messagePattern":"continual harness state (.+?) has (.+?) entries; maximum is (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/continual_harness.rs","lineNumber":267,"sourceCode":"            return Err(error)\n                .with_context(|| format!(\"read continual harness state {}\", path.display()));\n        }\n    };\n    let mut state: HarnessState = serde_json::from_str(&raw)\n        .with_context(|| format!(\"parse continual harness state {}\", path.display()))?;\n    if state.schema_version == 0 {\n        state.schema_version = SCHEMA_VERSION;\n    }\n    if state.schema_version > SCHEMA_VERSION {\n        bail!(\n            \"continual harness state {} uses newer schema {}; this Codewhale supports schema {}\",\n            path.display(),\n            state.schema_version,\n            SCHEMA_VERSION\n        );\n    }\n    if state.entries.len() > MAX_ENTRIES {\n        bail!(\n            \"continual harness state {} has {} entries; maximum is {MAX_ENTRIES}\",\n            path.display(),\n            state.entries.len()\n        );\n    }\n    Ok(state)\n}\n\nfn save_state(path: &Path, state: &HarnessState) -> Result<()> {\n    let parent = path\n        .parent()\n        .ok_or_else(|| anyhow!(\"continual harness state has no parent: {}\", path.display()))?;\n    fs::create_dir_all(parent)\n        .with_context(|| format!(\"create continual harness directory {}\", parent.display()))?;\n    let payload = serde_json::to_vec_pretty(state)?;\n    let tmp = path.with_extension(format!(\"{}.tmp\", Uuid::new_v4().simple()));\n    fs::write(&tmp, payload)\n        .with_context(|| format!(\"write continual harness temporary state {}\", tmp.display()))?;","sourceCodeStart":249,"sourceCodeEnd":285,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/continual_harness.rs#L249-L285","documentation":"Thrown by load_state when the harness state file contains more than MAX_ENTRIES (24) entries. Unlike the refine-time guard, this fires on read: the file on disk already exceeds the bound, typically because it was hand-edited, merged, or restored from a source that did not respect the cap.","triggerScenarios":"overview(), refine(), or remove() on a workspace whose state JSON lists 25+ entries; any manual edit or merge of the state file past the cap.","commonSituations":"Editing the state file directly to paste in entries; resolving a sync conflict by concatenating both sides; restoring an old backup on top of a fuller ledger.","solutions":["Edit the state file and delete entries until it has at most 24","Restore from a backup taken when the ledger was within bounds","Prefer the harness remove tool over hand-editing so the write lock and journal stay consistent"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let overview = continual_harness::overview(&workspace)?;\nassert!(overview.entries.len() <= 24, \"state file must not exceed 24 entries\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only mutate harness state through the refine/remove tools so the cap is enforced with locking","When merging or restoring state files, count entries before saving","Back up the state file before any manual surgery on it"],"tags":["rust","tui","harness","capacity","state","data-corruption"],"backgroundTag":"capacity-limit-exceeded","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}