Hmbown/CodeWhale · error
Runtime store root cannot be empty
Error message
Runtime store root cannot be empty
What it means
checked_runtime_store_root validates the configured runtime store root before use. An empty path cannot be resolved into a valid store location, so it is rejected eagerly. This is fail-loud validation of a misconfiguration.
Solutions
- Set the runtime store root to an absolute directory in config/CLI/env
- Reject empty store-root strings at config-load time with a clear message
- Fall back to a documented default directory instead of an empty path
Example fix
// before
let root: PathBuf = std::env::var("RUNTIME_STORE").unwrap_or_default().into(); // empty when unset
// after
let root: PathBuf = std::env::var("RUNTIME_STORE").context("RUNTIME_STORE must be set")?.into(); Defensive patterns
Strategy: validation
Validate before calling
fn store_root_ok(p: &Path) -> bool { !p.as_os_str().is_empty() } Type guard
fn non_empty(p: &Path) -> Option<&Path> { (!p.as_os_str().is_empty()).then_some(p) } Try / catch
match store.open(root).await {
Err(e) if e.to_string().contains("cannot be empty") => {
let root = default_store_root()?;
store.open(root).await?
}
other => other?,
} Prevention
- Use Option<PathBuf> for optional store roots instead of empty PathBuf
- Reject empty strings at config parse time
- Provide a non-empty default store directory
When it happens
Trigger: Constructing/opening the runtime store with an empty PathBuf (e.g. from an unset config value mapped to PathBuf::new(), or an empty CLI/env string).
Common situations: Config key for the store root present but empty string; env var unset parsed into an empty path; programmatically passing PathBuf::new() as a default.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- Codewhale credentials directory must be lexically normalized
- config path cannot be empty
- config path cannot contain '..' components
- config path must include a file name
- managed directory path cannot be empty
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/37d9322233a2cbf9.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/runtime_threads.rs:13689
0
} else {
u64::try_from(millis).unwrap_or(u64::MAX)
}
}
fn panic_payload_message(payload: &(dyn std::any::Any + Send)) -> String {
if let Some(message) = payload.downcast_ref::<&str>() {
(*message).to_string()
} else if let Some(message) = payload.downcast_ref::<String>() {
message.clone()
} else {
"unknown panic payload".to_string()
}
}
fn checked_runtime_store_root(root: PathBuf) -> Result<PathBuf> {
if root.as_os_str().is_empty() {
bail!("Runtime store root cannot be empty");
}
if root
.components()
.any(|component| matches!(component, Component::ParentDir))
{
bail!("Runtime store root cannot contain '..' components");
}
let absolute = if root.is_absolute() {
root
} else {
std::env::current_dir()
.context("failed to resolve current directory for runtime store")?
.join(root)
};
match absolute.canonicalize() {
Ok(path) => Ok(path),
Err(err) if err.kind() == std::io::ErrorKind::NotFound => {
Ok(normalize_path_components(&absolute))View on GitHub (pinned to 73e0f67d83)