{"record":{"id":"0c9f4dd469ccfb91","repo":"Hmbown/CodeWhale","slug":"session-goal-objective-must-contain-1-max-sessi","errorCode":null,"errorMessage":"Session goal objective must contain 1..={MAX_SESSION_GOAL_OBJECTIVE_CHARS} characters","messagePattern":"Session goal objective must contain 1\\.\\.=(.+?) characters","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/session_manager.rs","lineNumber":821,"sourceCode":"            last_gap_pass: snapshot.last_gap_pass,\n        };\n        state.validate()?;\n        Ok(Some(state))\n    }\n\n    pub fn validate(&self) -> io::Result<()> {\n        if self.schema_version > CURRENT_SESSION_GOAL_SCHEMA_VERSION {\n            return Err(io::Error::new(\n                io::ErrorKind::InvalidData,\n                format!(\n                    \"Session goal schema v{} is newer than supported v{}\",\n                    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(),","sourceCodeStart":803,"sourceCodeEnd":839,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/session_manager.rs#L803-L839","documentation":"SessionGoalState::validate requires the trimmed objective to be non-empty and at most MAX_SESSION_GOAL_OBJECTIVE_CHARS characters (counted in chars, not bytes). Objectives outside 1..=MAX chars fail with InvalidData.","triggerScenarios":"Loading (or validating) a goal state whose objective is empty/whitespace, or whose character count exceeds MAX_SESSION_GOAL_OBJECTIVE_CHARS.","commonSituations":"Pasting an entire requirements document into the objective; a script dumping long prompts into the goal file; empty objective left by interrupted creation.","solutions":["Shorten the objective in the goal file to within the character limit (keep it a concise goal statement).","Set a non-empty objective if it was blank.","Recreate the goal via the TUI, which enforces the limit at input time."],"exampleFix":"// before: objective is 5000 chars\n{\"objective\": \"<entire spec document>\", ...}\n// after\n{\"objective\": \"Implement spec section 3: parser rewrite\", ...}","handlingStrategy":"validation","validationCode":"fn objective_length_ok(s: &str, max: usize) -> bool {\n    let t = s.trim();\n    !t.is_empty() && t.chars().count() <= max\n}","typeGuard":null,"tryCatchPattern":"match load_goal(path) {\n    Err(e) if e.to_string().contains(\"objective must contain\") => {\n        eprintln!(\"objective is empty or too long; shorten it in the goal file\");\n    }\n    other => other?,\n}","preventionTips":["Keep objectives short — a goal statement, not a document.","Truncate or reject long inputs at goal-creation time.","Never leave objective blank when writing goal JSON."],"tags":["validation","limits","goals"],"backgroundTag":"value-out-of-range","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}