Hmbown/CodeWhale · error · std::io::Error
Session goal {} must be a regular file
Error message
Session goal {} must be a regular file What it means
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.
Source
Thrown at crates/tui/src/session_manager.rs:997
io::ErrorKind::NotFound,
format!("Session goal store {} was not created", dir.display()),
)
})
}
fn validated_session_goal_path(&self, session_id: &str) -> std::io::Result<PathBuf> {
let id = self.validated_session_id(session_id)?;
Ok(self.session_goals_dir().join(format!("{id}.json")))
}
fn checked_existing_session_goal_file(path: &Path) -> std::io::Result<bool> {
let metadata = match fs::symlink_metadata(path) {
Ok(metadata) => metadata,
Err(error) if error.kind() == io::ErrorKind::NotFound => return Ok(false),
Err(error) => return Err(error),
};
if metadata.file_type().is_symlink() || !metadata.is_file() {
return Err(io::Error::new(
io::ErrorKind::InvalidData,
format!("Session goal {} must be a regular file", path.display()),
));
}
Ok(true)
}
fn validated_checkpoint_path(&self, session_id: &str) -> std::io::Result<PathBuf> {
let trimmed = self.validated_session_id(session_id)?;
// Reserved file names inside `checkpoints/` must never collide with a
// per-session checkpoint file.
if format!("{trimmed}.json") == LEGACY_CHECKPOINT_FILE
|| format!("{trimmed}.json") == OFFLINE_QUEUE_FILE
{
return Err(std::io::Error::new(
std::io::ErrorKind::InvalidInput,
format!("Session id '{trimmed}' collides with a reserved checkpoint file"),
));View on GitHub (pinned to 0c42157ee5)
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.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/tui/src/session_manager.rs:997 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20).
Data as JSON: /api/errors/f72e0a3edea6ada4.
Report an issue: GitHub.