Hmbown/CodeWhale · error
goal snapshot has no objective
Error message
goal snapshot has no objective
What it means
When converting a persisted goal snapshot into session state, the objective field must exist and be non-empty after trimming. A snapshot whose objective is missing, whitespace-only, or empty cannot form a valid session goal, so InvalidData is thrown with this message.
Solutions
- Edit the goal snapshot file and set a non-empty objective string.
- Delete the goal file so the session starts without a goal, then set a new goal in the TUI.
- Recreate the goal through the interactive session instead of editing files by hand.
Example fix
// before: sessions/goal.json
{"objective": "", "status": "active", ...}
// after
{"objective": "Ship the parser rewrite", "status": "active", ...} Defensive patterns
Strategy: validation
Validate before calling
fn goal_objective_valid(snapshot: &GoalSnapshot) -> bool {
snapshot.objective.as_deref().map(str::trim).map_or(false, |o| !o.is_empty())
} Type guard
fn has_objective(s: &Option<String>) -> bool {
s.as_deref().map(|o| !o.trim().is_empty()).unwrap_or(false)
} Try / catch
match load_goal(path) {
Err(e) if e.kind() == std::io::ErrorKind::InvalidData && e.to_string().contains("no objective") => {
eprintln!("goal file lacks an objective; delete it and set a new goal");
}
other => other?,
} Prevention
- Never hand-edit goal files; use the TUI to set goals.
- Ensure objective is non-empty when generating goal JSON.
- Back up goal files before schema/version changes.
When it happens
Trigger: Loading a goal snapshot whose JSON lacks the objective field, has objective: null, or objective set to "" or only whitespace.
Common situations: Hand-edited or partially written goal files; older tooling that wrote goal snapshots without an objective; a crash during goal creation left an empty objective; schema drift between versions.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- {error}
- goal snapshot has unsupported status
- invalid session goal revision
- Session goal objective must contain 1..=
- Session goal schema v
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/e600f0e3f10a0f67.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/session_manager.rs:776
const fn current_session_goal_schema_version() -> u32 {
CURRENT_SESSION_GOAL_SCHEMA_VERSION
}
impl SessionGoalState {
/// Convert a runtime update into the durable, bounded session contract.
/// The canonical empty runtime snapshot removes the sidecar.
pub fn from_runtime(snapshot: &GoalSnapshot) -> io::Result<Option<Self>> {
if snapshot.objective.is_none() && snapshot.status.trim() == "none" {
return Ok(None);
}
let objective = snapshot
.objective
.as_deref()
.map(str::trim)
.filter(|objective| !objective.is_empty())
.ok_or_else(|| {
io::Error::new(io::ErrorKind::InvalidData, "goal snapshot has no objective")
})?;
let status = match snapshot.status.trim() {
"active" => SessionGoalStatus::Active,
"paused" => SessionGoalStatus::Paused,
"complete" => SessionGoalStatus::Complete,
"blocked" => SessionGoalStatus::Blocked,
other => {
return Err(io::Error::new(
io::ErrorKind::InvalidData,
format!("goal snapshot has unsupported status '{other}'"),
));
}
};
let state = Self {
schema_version: CURRENT_SESSION_GOAL_SCHEMA_VERSION,
objective: objective.to_string(),
status,
token_budget: snapshot.token_budget,View on GitHub (pinned to 73e0f67d83)