{"record":{"id":"f72e0a3edea6ada4","repo":"Hmbown/CodeWhale","slug":"session-goal-must-be-a-regular-file","errorCode":null,"errorMessage":"Session goal {} must be a regular file","messagePattern":"Session goal (.+?) must be a regular file","errorType":"validation","errorClass":"std::io::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/session_manager.rs","lineNumber":997,"sourceCode":"                io::ErrorKind::NotFound,\n                format!(\"Session goal store {} was not created\", dir.display()),\n            )\n        })\n    }\n\n    fn validated_session_goal_path(&self, session_id: &str) -> std::io::Result<PathBuf> {\n        let id = self.validated_session_id(session_id)?;\n        Ok(self.session_goals_dir().join(format!(\"{id}.json\")))\n    }\n\n    fn checked_existing_session_goal_file(path: &Path) -> std::io::Result<bool> {\n        let metadata = match fs::symlink_metadata(path) {\n            Ok(metadata) => metadata,\n            Err(error) if error.kind() == io::ErrorKind::NotFound => return Ok(false),\n            Err(error) => return Err(error),\n        };\n        if metadata.file_type().is_symlink() || !metadata.is_file() {\n            return Err(io::Error::new(\n                io::ErrorKind::InvalidData,\n                format!(\"Session goal {} must be a regular file\", path.display()),\n            ));\n        }\n        Ok(true)\n    }\n\n    fn validated_checkpoint_path(&self, session_id: &str) -> std::io::Result<PathBuf> {\n        let trimmed = self.validated_session_id(session_id)?;\n        // Reserved file names inside `checkpoints/` must never collide with a\n        // per-session checkpoint file.\n        if format!(\"{trimmed}.json\") == LEGACY_CHECKPOINT_FILE\n            || format!(\"{trimmed}.json\") == OFFLINE_QUEUE_FILE\n        {\n            return Err(std::io::Error::new(\n                std::io::ErrorKind::InvalidInput,\n                format!(\"Session id '{trimmed}' collides with a reserved checkpoint file\"),\n            ));","sourceCodeStart":979,"sourceCodeEnd":1015,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/session_manager.rs#L979-L1015","documentation":"File-type guard in checked_existing_session_goal_file: the per-session goal file exists but symlink_metadata shows it is not a regular file (symlink, directory, or other), so the manager refuses to read or write it as a goal store file.","triggerScenarios":"Thrown at crates/tui/src/session_manager.rs:997 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the non-regular file at the goal path and let the manager recreate it.","Restore the `<session-id>.json` sidecar as a regular file from backup.","Check sync/restore tools that may have created links in the goals directory."],"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-14T05:17:10.506Z"}