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

managed directory path cannot be empty

Error message

managed directory path cannot be empty

What it means

Validation in normalize_managed_dir (called from the session manager constructor): the managed directory path was empty. Session goals, queue, and receipt stores all live under this root; an empty path would resolve relative paths against the process CWD, so construction fails immediately with InvalidInput.

Source

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

const WORK_GRAPH_IMPORT_ARCHIVE_DIR: &str = ".work-graph-import-archive";
const SESSION_GOALS_DIR: &str = ".goals";
const CURRENT_SESSION_GOAL_SCHEMA_VERSION: u32 = 1;
const MAX_SESSION_GOAL_OBJECTIVE_CHARS: usize = 8_192;
const MAX_SESSION_GOAL_FILE_BYTES: u64 = 64 * 1_024;
const CURRENT_SESSION_SCHEMA_VERSION: u32 = 1;
const CURRENT_QUEUE_SCHEMA_VERSION: u32 = 1;

const fn default_session_schema_version() -> u32 {
    CURRENT_SESSION_SCHEMA_VERSION
}

const fn default_queue_schema_version() -> u32 {
    CURRENT_QUEUE_SCHEMA_VERSION
}

fn normalize_managed_dir(path: PathBuf) -> std::io::Result<PathBuf> {
    if path.as_os_str().is_empty() {
        return Err(std::io::Error::new(
            std::io::ErrorKind::InvalidInput,
            "managed directory path cannot be empty",
        ));
    }
    if path.components().any(|component| {
        matches!(
            component,
            Component::ParentDir | Component::Prefix(_) | Component::RootDir
        )
    }) && path.is_relative()
    {
        return Err(std::io::Error::new(
            std::io::ErrorKind::InvalidInput,
            "managed directory path cannot contain traversal components",
        ));
    }
    if path.is_absolute() {
        return Ok(path);

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Configure a valid sessions directory path before constructing the session manager.
  2. Check that config resolution actually populated the directory setting rather than leaving it empty.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/tui/src/session_manager.rs:53 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/1522ca75ddceff1c. Report an issue: GitHub.