Hmbown/CodeWhale · error · anyhow::Error

continual harness state {} has {} entries; maximum is {MAX_E

Error message

continual harness state {} has {} entries; maximum is {MAX_ENTRIES}

What it means

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.

Source

Thrown at crates/tui/src/continual_harness.rs:267

            return Err(error)
                .with_context(|| format!("read continual harness state {}", path.display()));
        }
    };
    let mut state: HarnessState = serde_json::from_str(&raw)
        .with_context(|| format!("parse continual harness state {}", path.display()))?;
    if state.schema_version == 0 {
        state.schema_version = SCHEMA_VERSION;
    }
    if state.schema_version > SCHEMA_VERSION {
        bail!(
            "continual harness state {} uses newer schema {}; this Codewhale supports schema {}",
            path.display(),
            state.schema_version,
            SCHEMA_VERSION
        );
    }
    if state.entries.len() > MAX_ENTRIES {
        bail!(
            "continual harness state {} has {} entries; maximum is {MAX_ENTRIES}",
            path.display(),
            state.entries.len()
        );
    }
    Ok(state)
}

fn save_state(path: &Path, state: &HarnessState) -> Result<()> {
    let parent = path
        .parent()
        .ok_or_else(|| anyhow!("continual harness state has no parent: {}", path.display()))?;
    fs::create_dir_all(parent)
        .with_context(|| format!("create continual harness directory {}", parent.display()))?;
    let payload = serde_json::to_vec_pretty(state)?;
    let tmp = path.with_extension(format!("{}.tmp", Uuid::new_v4().simple()));
    fs::write(&tmp, payload)
        .with_context(|| format!("write continual harness temporary state {}", tmp.display()))?;

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Edit the state file and delete entries until it has at most 24
  2. Restore from a backup taken when the ledger was within bounds
  3. Prefer the harness remove tool over hand-editing so the write lock and journal stay consistent
Defensive patterns

Strategy: validation

Validate before calling

let overview = continual_harness::overview(&workspace)?;
assert!(overview.entries.len() <= 24, "state file must not exceed 24 entries");

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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