Hmbown/CodeWhale · error
Codewhale credentials directory cannot be a volume root
Error message
Codewhale credentials directory cannot be a volume root
What it means
The windows opener keeps a validated non-delete-shared handle for every Normal path component; if there are none, the directory is a volume root (C:\\ or \\server\\share). A volume root cannot be given an owner-only DACL safely (it would lock the whole drive), so opening is refused. The public path always appends the `credentials` component, so this only fires for direct internal calls with a root path.
Source
Thrown at crates/config/src/xai_credentials.rs:832
.read(true)
.share_mode(FILE_SHARE_READ | FILE_SHARE_WRITE)
.custom_flags(FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT);
let handle = options.open(¤t).with_context(|| {
format!(
"opening Codewhale credentials directory component {}",
crate::quote_os_path(¤t)
)
})?;
validate_windows_handle_path(&handle, ¤t, true)?;
handles.push(handle);
}
Component::CurDir | Component::ParentDir => bail!(
"Codewhale credentials directory must be lexically normalized: {}",
crate::quote_os_path(directory)
),
}
}
anyhow::ensure!(
!handles.is_empty(),
"Codewhale credentials directory cannot be a volume root"
);
let mut secure_options = fs::OpenOptions::new();
secure_options
.access_mode(FILE_GENERIC_READ | WRITE_DAC | WRITE_OWNER)
.share_mode(FILE_SHARE_READ | FILE_SHARE_WRITE)
.custom_flags(FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT);
let final_directory = secure_options.open(directory).with_context(|| {
format!(
"opening Codewhale credentials directory for owner-only security: {}",
crate::quote_os_path(directory)
)
})?;
validate_windows_handle_path(&final_directory, directory, true)?;
secure_windows_owner_only_handle(&final_directory, true)
.context("securing Codewhale credentials directory for the current user")?;
verify_windows_owner_only_handle(&final_directory)View on GitHub (pinned to 8880682c63)
Solutions
- Ensure the directory path has at least one real component below the drive/UNC root (e.g. append `credentials`)
- Use the public entry points, which always build $CODEWHALE_HOME/credentials
Defensive patterns
Strategy: validation
Validate before calling
use std::path::Component;
fn below_volume_root(p: &std::path::Path) -> bool {
p.components().any(|c| matches!(c, Component::Normal(_)))
} Prevention
- Always keep at least the `credentials` component under the drive/UNC root
- Use public entry points that append the component for you
- Reject CODEWHALE_HOME values that normalize to a bare drive root
When it happens
Trigger: Calling the private opener with Path::new("C:\\") or a UNC root; refactors or tests that compute the credentials directory without appending a normal component.
Common situations: In-crate tests; refactors that collapse the derived path to a drive or UNC root through normalization.
Related errors
- invalid Codewhale-owned xAI OAuth basename
- xAI OAuth private basename must be one UTF-8 path component
- refusing to replace an existing xAI OAuth generation
- Codewhale-owned xAI OAuth path must not be a reparse point
- Codewhale-owned xAI OAuth path has the wrong filesystem type
AI-assisted analysis of Hmbown/CodeWhale@8880682c63 (2026-08-16).
Data as JSON: /api/errors/3783dc3611fc11f3.
Report an issue: GitHub.