Hmbown/CodeWhale · error

{error}

Error message

{error}

What it means

Session goal stall tracking (last_gap_fingerprint, repeated_gap_count, last_gap_pass, continuation_count) is validated by codewhale_protocol::validate_goal_stall_state. Any validation error returned there is wrapped verbatim into an InvalidData io::Error — so the inner protocol message ('{error}') is the actual diagnostic.

Solutions

  1. Read the wrapped message for the specific protocol rule broken and correct the stall-state fields accordingly.
  2. Reset the stall fields (clear last_gap_fingerprint, zero the counters) so validation passes and tracking restarts.
  3. Recreate the goal via the TUI instead of editing state files directly.

Example fix

// before: fingerprint set but counters inconsistent
{"last_gap_fingerprint": "abc", "repeated_gap_count": 0, "continuation_count": 7}
// after: reset stall tracking
{"last_gap_fingerprint": null, "repeated_gap_count": 0, "continuation_count": 0}
Defensive patterns

Strategy: validation

Validate before calling

fn stall_state_plausible(fp: &Option<String>, counts: (u32,u32,u32)) -> bool {
    fp.is_some() == (counts.0 > 0 || counts.1 > 0 || counts.2 > 0)
}

Try / catch

match load_goal(path) {
    Err(e) if e.kind() == std::io::ErrorKind::InvalidData => {
        eprintln!("stall-state invalid: {e}"); // message is the protocol's own diagnostic
    }
    other => other?,
}

Prevention

When it happens

Trigger: Loading or validating a goal state whose stall-state fields violate protocol invariants — e.g. a gap fingerprint present without counts, mismatched pass/continuation counters, or inconsistent combinations of these fields.

Common situations: Hand-edited goal files with partially updated stall fields; merging session state from two machines; truncation or manual patching of counters during debugging.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at crates/tui/src/session_manager.rs:844

            ));
        }
        if self
            .goal_id
            .as_ref()
            .is_some_and(|id| id.is_empty() || id.len() > 128)
        {
            return Err(io::Error::new(
                io::ErrorKind::InvalidData,
                "invalid session goal revision",
            ));
        }
        codewhale_protocol::validate_goal_stall_state(
            self.last_gap_fingerprint.as_deref(),
            self.repeated_gap_count,
            self.last_gap_pass,
            self.continuation_count,
        )
        .map_err(|error| io::Error::new(io::ErrorKind::InvalidData, error))
    }

    #[must_use]
    pub fn to_runtime_snapshot(&self) -> GoalSnapshot {
        GoalSnapshot {
            goal_id: self.goal_id.clone(),
            objective: Some(self.objective.clone()),
            status: match self.status {
                SessionGoalStatus::Active => "active",
                SessionGoalStatus::Paused => "paused",
                SessionGoalStatus::Complete => "complete",
                SessionGoalStatus::Blocked => "blocked",
            }
            .to_string(),
            token_budget: self.token_budget,
            tokens_used: self.tokens_used,
            time_used_seconds: self.time_used_seconds,
            continuation_count: self.continuation_count,

View on GitHub (pinned to 73e0f67d83)