Hmbown/CodeWhale · error · std::io::Error

Session goal store {} must be a real directory

Error message

Session goal store {} must be a real directory

What it means

Directory-type guard in checked_existing_session_goals_dir: the session goals path exists but symlink_metadata shows it is not a real directory (symlink, file, or other), so the manager refuses to use it as the goal store.

Source

Thrown at crates/tui/src/session_manager.rs:956

    }

    fn checkpoints_dir(&self) -> PathBuf {
        self.sessions_dir.join("checkpoints")
    }

    fn session_goals_dir(&self) -> PathBuf {
        self.sessions_dir.join(SESSION_GOALS_DIR)
    }

    fn checked_existing_session_goals_dir(&self) -> std::io::Result<Option<PathBuf>> {
        let dir = self.session_goals_dir();
        let metadata = match fs::symlink_metadata(&dir) {
            Ok(metadata) => metadata,
            Err(error) if error.kind() == io::ErrorKind::NotFound => return Ok(None),
            Err(error) => return Err(error),
        };
        if metadata.file_type().is_symlink() || !metadata.is_dir() {
            return Err(io::Error::new(
                io::ErrorKind::InvalidData,
                format!(
                    "Session goal store {} must be a real directory",
                    dir.display()
                ),
            ));
        }
        Ok(Some(dir))
    }

    fn ensure_session_goals_dir(&self) -> std::io::Result<PathBuf> {
        if let Some(dir) = self.checked_existing_session_goals_dir()? {
            return Ok(dir);
        }
        let dir = self.session_goals_dir();
        match fs::create_dir(&dir) {
            Ok(()) => {}
            Err(error) if error.kind() == io::ErrorKind::AlreadyExists => {}

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Remove the symlink/file at the goals path and let the manager recreate a real directory.
  2. Restore the `.goals` directory as a genuine directory from backup.
  3. Check tooling that may have replaced the directory with a link.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/tui/src/session_manager.rs:956 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/3f310eaa13e3e55e. Report an issue: GitHub.