Hmbown/CodeWhale · error

invalid memory workspace id

Error message

invalid memory workspace id

What it means

safe_component rejected a workspace id that would be unsafe as a path component: empty, `.`, `..`, or containing `/` or `\`. Workspace ids become file names under the memory directory, so this is a path-traversal containment guard, not a format preference.

Source

Thrown at crates/tui/src/native_memory.rs:911

    Ok(note.trim_start_matches('-').trim().to_string())
}

fn validate_query(query: &str) -> Result<&str> {
    let query = query.trim();
    if query.is_empty() || query.chars().count() > MAX_QUERY_CHARS {
        bail!("memory search query is empty or too long");
    }
    Ok(query)
}

fn safe_component(value: &str) -> Result<String> {
    if value.is_empty()
        || value == "."
        || value == ".."
        || value.contains('/')
        || value.contains('\\')
    {
        bail!("invalid memory workspace id");
    }
    Ok(value.to_string())
}

fn ensure_memory_file(path: &Path) -> Result<()> {
    if let Some(parent) = path.parent() {
        fs::create_dir_all(parent)?;
    }
    if !path.exists() {
        File::create(path)?;
    }
    Ok(())
}

fn file_mtime(path: &Path) -> Result<i64> {
    Ok(fs::metadata(path)?
        .modified()?
        .duration_since(UNIX_EPOCH)

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Use a plain workspace id without separators or dot segments
  2. Retry the memory operation
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/tui/src/native_memory.rs:911 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/694dfa3fa2fbdcf1. Report an issue: GitHub.