{"record":{"id":"0827325c8afab15e","repo":"Hmbown/CodeWhale","slug":"invalid-session-path","errorCode":null,"errorMessage":"invalid session path","messagePattern":"invalid session path","errorType":"validation","errorClass":"std::io::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/session_manager.rs","lineNumber":1245,"sourceCode":"            .and_then(|state| state.graph.as_ref())\n            .is_some_and(|graph| !graph.is_empty());\n        if !writes_graph || !source.exists() {\n            return Ok(());\n        }\n        let bytes = fs::read(source)?;\n        let already_graph_backed = serde_json::from_slice::<SavedSession>(&bytes)\n            .ok()\n            .and_then(|saved| saved.work_state)\n            .and_then(|state| state.graph)\n            .is_some_and(|graph| !graph.is_empty());\n        if already_graph_backed {\n            return Ok(());\n        }\n        let archive_dir = self.sessions_dir.join(WORK_GRAPH_IMPORT_ARCHIVE_DIR);\n        fs::create_dir_all(&archive_dir)?;\n        let archive =\n            archive_dir.join(source.file_name().ok_or_else(|| {\n                io::Error::new(io::ErrorKind::InvalidInput, \"invalid session path\")\n            })?);\n        if !archive.exists() {\n            write_atomic(&archive, &bytes)?;\n        }\n        Ok(())\n    }\n\n    fn read_checkpoint_file(&self, path: &Path) -> std::io::Result<Option<SavedSession>> {\n        if !path.exists() {\n            return Ok(None);\n        }\n        let content = fs::read_to_string(path)?;\n        let mut session: SavedSession = serde_json::from_str(&content)\n            .map_err(|e| std::io::Error::new(std::io::ErrorKind::InvalidData, e))?;\n        if session.schema_version > CURRENT_SESSION_SCHEMA_VERSION {\n            return Err(std::io::Error::new(\n                std::io::ErrorKind::InvalidData,\n                format!(","sourceCodeStart":1227,"sourceCodeEnd":1263,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/session_manager.rs#L1227-L1263","documentation":"A generic InvalidInput guard raised while archiving a legacy work-state file: source.file_name() returned None, so the path terminates in '..' or is a filesystem root. The archive step needs a real file name to copy under, and cannot proceed without one.","triggerScenarios":"Thrown at crates/tui/src/session_manager.rs:1245 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a concrete file path (not a root or '..-terminated path) as the session source","Resolve the session path to a canonical file before invoking the archive/migration step"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}