Hmbown/CodeWhale · error
continual harness must be ..= characters
Error message
continual harness {field} must be {min}..={max} characters What it means
normalize_bounded enforces per-field length limits on harness refinements (title and content 1..max, evidence 16..max characters after trimming); this error fires when a field falls outside its min..=max range, naming the field and bounds.
Solutions
- Trim and check the character count (chars().count(), not byte length) of your value before calling
- Shorten the value to within max characters
- Provide a longer value if it is below min (including non-whitespace content)
Example fix
// before let value = " ".to_string(); // trims to 0 chars, min is 1 // after let value = "narrow the search scope".trim().to_string();
Defensive patterns
Strategy: validation
Validate before calling
fn in_bounds(s: &str, min: usize, max: usize) -> bool {
let n = s.trim().chars().count();
n >= min && n <= max
} Prevention
- Always trim and count chars() (not bytes) before submitting
- Enforce field length limits in your own input UI
- Reject whitespace-only input before calling the API
When it happens
Trigger: Calling validate_refinement with a field value whose trimmed character count is < min or > max for that field's bounds.
Common situations: Pasting in a refinement description longer than the cap, submitting whitespace-only text that trims to empty (below min), or counting bytes instead of characters for multibyte input.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- memory search query is empty or too long
- Session title cannot exceed
- Use a name between 1 and 200 characters.
- 1
- A pinned task provider requires an explicit model
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/a4e1f0045a74464b.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/continual_harness.rs:348
state_path.display()
)
})?;
operation()
}
fn validate_refinement(mut refinement: HarnessRefinement) -> Result<HarnessRefinement> {
refinement.title = normalize_bounded("title", refinement.title, MAX_TITLE_CHARS, 1)?;
refinement.content = normalize_bounded("content", refinement.content, MAX_CONTENT_CHARS, 1)?;
refinement.evidence =
normalize_bounded("evidence", refinement.evidence, MAX_EVIDENCE_CHARS, 16)?;
Ok(refinement)
}
fn normalize_bounded(field: &str, value: String, max: usize, min: usize) -> Result<String> {
let value = value.trim().to_string();
let len = value.chars().count();
if len < min || len > max {
bail!("continual harness {field} must be {min}..={max} characters");
}
Ok(value)
}
fn truncate_chars(value: &str, max: usize) -> String {
let mut chars = value.chars();
let head: String = chars.by_ref().take(max).collect();
if chars.next().is_some() {
format!("{head}…")
} else {
head
}
}
fn escape_for_prompt(value: &str) -> String {
value
.replace('&', "&")
.replace('<', "<")View on GitHub (pinned to 73e0f67d83)