{"record":{"id":"f8be4f1e0ea7047d","repo":"Hmbown/CodeWhale","slug":"session-id-trimmed-collides-with-a-reserved-ch","errorCode":null,"errorMessage":"Session id '{trimmed}' collides with a reserved checkpoint file","messagePattern":"Session id '(.+?)' collides with a reserved checkpoint file","errorType":"validation","errorClass":"std::io::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/session_manager.rs","lineNumber":1012,"sourceCode":"            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            ));\n        }\n        Ok(self.checkpoints_dir().join(format!(\"{trimmed}.json\")))\n    }\n\n    /// Create a new `SessionManager` with the specified sessions directory\n    pub fn new(sessions_dir: PathBuf) -> std::io::Result<Self> {\n        let sessions_dir = normalize_managed_dir(sessions_dir)?;\n        // Ensure the sessions directory exists\n        fs::create_dir_all(&sessions_dir)?;\n        Ok(Self { sessions_dir })\n    }\n\n    /// Create a `SessionManager` using the default location.\n    pub fn default_location() -> std::io::Result<Self> {\n        Self::new(default_sessions_dir()?)","sourceCodeStart":994,"sourceCodeEnd":1030,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/session_manager.rs#L994-L1030","documentation":"validated_checkpoint_path() rejects a caller-supplied session id whose trimmed value names a reserved file inside the checkpoints/ directory (e.g. offline_queue.json). This is a generic guard on untrusted session-id input: firing means the id would address a fixed control file instead of a per-session checkpoint, risking overwrite of durable queue/manifest state.","triggerScenarios":"Thrown at crates/tui/src/session_manager.rs:1012 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Choose a different session id that does not equal a reserved checkpoint file name","Sanitize/namespace user-supplied ids before passing them to session_manager APIs","Add the reserved-name check earlier, at session creation time, so colliding ids never enter the system"],"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"}