{"record":{"id":"b3d5332624952df9","repo":"Hmbown/CodeWhale","slug":"invalid-session-goal-revision","errorCode":null,"errorMessage":"invalid session goal revision","messagePattern":"invalid session goal revision","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/session_manager.rs","lineNumber":833,"sourceCode":"                    self.schema_version, CURRENT_SESSION_GOAL_SCHEMA_VERSION\n                ),\n            ));\n        }\n        let objective = self.objective.trim();\n        if objective.is_empty() || objective.chars().count() > MAX_SESSION_GOAL_OBJECTIVE_CHARS {\n            return Err(io::Error::new(\n                io::ErrorKind::InvalidData,\n                format!(\n                    \"Session goal objective must contain 1..={MAX_SESSION_GOAL_OBJECTIVE_CHARS} characters\"\n                ),\n            ));\n        }\n        if self\n            .goal_id\n            .as_ref()\n            .is_some_and(|id| id.is_empty() || id.len() > 128)\n        {\n            return Err(io::Error::new(\n                io::ErrorKind::InvalidData,\n                \"invalid session goal revision\",\n            ));\n        }\n        codewhale_protocol::validate_goal_stall_state(\n            self.last_gap_fingerprint.as_deref(),\n            self.repeated_gap_count,\n            self.last_gap_pass,\n            self.continuation_count,\n        )\n        .map_err(|error| io::Error::new(io::ErrorKind::InvalidData, error))\n    }\n\n    #[must_use]\n    pub fn to_runtime_snapshot(&self) -> GoalSnapshot {\n        GoalSnapshot {\n            goal_id: self.goal_id.clone(),\n            objective: Some(self.objective.clone()),","sourceCodeStart":815,"sourceCodeEnd":851,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/session_manager.rs#L815-L851","documentation":"When a goal_id is present, it must be non-empty and at most 128 bytes; otherwise SessionGoalState::validate rejects the state with this InvalidData error. This guards the revision identifier used to detect concurrent goal changes.","triggerScenarios":"Loading a goal state where goal_id is Some(\"\") or a string longer than 128 bytes/chars.","commonSituations":"Hand-edited goal files setting goal_id to an empty string; scripts generating oversized IDs; corruption or truncation of the goal file.","solutions":["Fix or remove the goal_id field in the goal file (a valid non-empty ID ≤128 chars, or null).","Delete the goal file and recreate the goal via the TUI.","Use the session's own goal commands to regenerate a valid revision instead of hand-crafting IDs."],"exampleFix":"// before\n{\"goal_id\": \"\", ...}\n// after\n{\"goal_id\": \"g-8f14e45f\", ...}   // or remove the field / set null","handlingStrategy":"validation","validationCode":"fn goal_id_ok(id: &Option<String>) -> bool {\n    id.as_ref().map(|i| !i.is_empty() && i.len() <= 128).unwrap_or(true)\n}","typeGuard":null,"tryCatchPattern":"match load_goal(path) {\n    Err(e) if e.to_string().contains(\"invalid session goal revision\") => {\n        eprintln!(\"goal_id must be non-empty and <=128 chars, or absent\");\n    }\n    other => other?,\n}","preventionTips":["Let Codewhale generate goal_ids; don't hand-craft them.","Validate ID length before writing goal JSON programmatically.","Set goal_id to null rather than \"\" when clearing it."],"tags":["validation","goals","identifier"],"backgroundTag":"invalid-identifier-format","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-22T11:17:16.035Z"}