Hmbown/CodeWhale · error

continual harness is full

Error message

continual harness is full ({MAX_ENTRIES} entries); remove an obsolete entry before refining again

What it means

The continual harness caps its persisted entry list at MAX_ENTRIES. refine() refuses to add new refinements once the cap is reached (exact duplicates still short-circuit earlier), requiring the caller to remove an obsolete entry first.

Solutions

  1. Call remove(workspace, id) on an obsolete entry, then retry refine().
  2. Review the harness state file and prune stale entries.
  3. Deduplicate refinements before calling refine.

Example fix

// before
harness::refine(ws, r)?; // fails when full
// after
if harness::list(ws)?.len() >= harness::MAX_ENTRIES {
    harness::remove(ws, &oldest_id)?;
}
harness::refine(ws, r)?;
Defensive patterns

Strategy: validation

Validate before calling

let ids: Vec<String> = continual_harness::list(ws)?.iter().map(|e| e.id.clone()).collect();
if ids.len() >= continual_harness::MAX_ENTRIES {
    continual_harness::remove(ws, &oldest_id)?;
}

Type guard

fn harness_has_capacity(ws: &Path) -> bool {
    continual_harness::list(ws).map(|e| e.len() < continual_harness::MAX_ENTRIES).unwrap_or(false)
}

Try / catch

match harness::refine(ws, r) {
    Err(e) if e.to_string().contains("harness is full") => { harness::remove(ws, &pick_obsolete(ws)?)?; harness::refine(ws, r) }
    other => other,
}

Prevention

When it happens

Trigger: Calling refine() when state.entries.len() >= MAX_ENTRIES and the refinement is not an exact duplicate of an existing entry. Hit by tests including refinement_persists_and_renders_as_untrusted_context, concurrent_refinements_merge_under_the_write_lock, and others.

Common situations: Long-lived workspaces that accumulate harness entries across many sessions until the journal is full.

Understand the failure class

Background: "File too large" / "file size exceeds limit" errors: why libraries cap file sizes and how to fix them — this error's family across 46 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/6ad92f0ae1b3a2dd. Report an issue: GitHub.

Appendix: source

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

pub fn refine(workspace: &Path, refinement: HarnessRefinement) -> Result<HarnessEntry> {
    let refinement = validate_refinement(refinement)?;
    let path = state_path_for_write(workspace)?;
    with_write_lock(&path, || {
        // Reload *inside* the cross-process writer lock. Atomic publication
        // protects readers from torn JSON, while this transaction prevents
        // two approved refinements from both deriving changes from a stale
        // snapshot and dropping one another's entry.
        let mut state = load_state(&path)?;

        if let Some(existing) = state.entries.iter().find(|entry| {
            entry.kind == refinement.kind
                && entry.title == refinement.title
                && entry.content == refinement.content
        }) {
            return Ok(existing.clone());
        }
        if state.entries.len() >= MAX_ENTRIES {
            bail!(
                "continual harness is full ({MAX_ENTRIES} entries); remove an obsolete entry before refining again"
            );
        }

        let entry = HarnessEntry {
            id: format!("h_{}", Uuid::new_v4().simple()),
            kind: refinement.kind,
            title: refinement.title,
            content: refinement.content,
            evidence: refinement.evidence,
        };
        state.schema_version = SCHEMA_VERSION;
        state.entries.push(entry.clone());
        save_state(&path, &state)?;
        // Journalled after the state is durable: a logged edit that never
        // landed would be worse than an unlogged one.
        append_journal(&path, "refine", &entry)?;
        Ok(entry)

View on GitHub (pinned to 73e0f67d83)