Hmbown/CodeWhale · error · std::io::Error
Session goal {} is {file_len} bytes; maximum is {MAX_SESSION
Error message
Session goal {} is {file_len} bytes; maximum is {MAX_SESSION_GOAL_FILE_BYTES} What it means
The serialized session-goal file written to the session goals directory exceeds MAX_SESSION_GOAL_FILE_BYTES. The write path enforces a size ceiling so a pathologically large goal payload cannot bloat the sessions directory or slow startup; firing means the caller supplied an oversized goal object.
Source
Thrown at crates/tui/src/session_manager.rs:1071
self.ensure_session_goals_dir()?;
Self::checked_existing_session_goal_file(&path)?;
let content = serde_json::to_string_pretty(goal)
.map_err(|error| io::Error::new(io::ErrorKind::InvalidData, error))?;
write_atomic(&path, content.as_bytes())
}
/// Load a saved session's durable goal, rejecting malformed or future
/// records instead of silently starting a different objective.
pub fn load_session_goal(&self, session_id: &str) -> std::io::Result<Option<SessionGoalState>> {
let path = self.validated_session_goal_path(session_id)?;
if self.checked_existing_session_goals_dir()?.is_none()
|| !Self::checked_existing_session_goal_file(&path)?
{
return Ok(None);
}
let file_len = fs::metadata(&path)?.len();
if file_len > MAX_SESSION_GOAL_FILE_BYTES {
return Err(io::Error::new(
io::ErrorKind::InvalidData,
format!(
"Session goal {} is {file_len} bytes; maximum is {MAX_SESSION_GOAL_FILE_BYTES}",
path.display()
),
));
}
let raw = fs::read_to_string(path)?;
let goal: SessionGoalState = serde_json::from_str(&raw)
.map_err(|error| io::Error::new(io::ErrorKind::InvalidData, error))?;
goal.validate()?;
Ok(Some(goal))
}
/// Save a session to disk using atomic write (temp file + fsync + rename).
pub fn save_session(&self, session: &SavedSession) -> std::io::Result<PathBuf> {
let path = self.validated_session_path(&session.metadata.id)?;
let already_persisted = path.exists()View on GitHub (pinned to 0c42157ee5)
Solutions
- Reduce the size of the SessionGoalState payload before saving
- Raise MAX_SESSION_GOAL_FILE_BYTES only if goals legitimately need more space
- Reject or truncate oversized goals at the UI/editor layer before persisting
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/tui/src/session_manager.rs:1071 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20).
Data as JSON: /api/errors/f30bc517c7a68903.
Report an issue: GitHub.