tonhowtf/omniget · error
external_data_cache: OS cache dir unavailable on this…
Error message
external_data_cache: OS cache dir unavailable on this platform
What it means
In non-portable mode external_data_cache uses dirs::cache_dir() to find the OS cache directory; when the platform cannot supply one (or the XDG cache env/home lookup fails) it raises this error. Without an OS cache dir the plugin's external cache cannot be located.
Solutions
- Set XDG_CACHE_HOME (or HOME) in the launch environment before starting the app.
- Set OMNIGET_PORTABLE to force the app-data-dir cache base instead.
- Run the app in a normal user session where the OS cache dir exists.
- Wrap the cache path resolution with a temp-dir fallback for headless/service contexts.
Example fix
// launch environment fix (systemd unit) [Service] Environment=HOME=/home/omniget Environment=XDG_CACHE_HOME=/home/omniget/.cache
Defensive patterns
Strategy: fallback
Validate before calling
let has_cache = std::env::var("XDG_CACHE_HOME").is_ok()
|| std::env::var("HOME").is_ok()
|| dirs::cache_dir().is_some();
if !has_cache { eprintln!("no OS cache dir; set XDG_CACHE_HOME"); } Try / catch
let dir = host.external_data_cache(pid, ns)
.unwrap_or_else(|_| std::env::temp_dir().join("omniget-external-cache").join(pid)); Prevention
- Always set HOME/XDG_CACHE_HOME when launching from services or containers
- Use the portable mode flag as an escape hatch in headless environments
- Provide a temp-dir fallback for cache locations
When it happens
Trigger: Calling external_data_cache without OMNIGET_PORTABLE on a system where dirs::cache_dir() returns None: Linux without XDG_CACHE_HOME and without a resolvable $HOME, or exotic embedded platform.
Common situations: Running the app as a systemd service or cron job with HOME unset on Linux; minimal containers without /home; sandboxed environments stripping env vars.
Understand the failure class
Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.
Related errors
- external_data_cache: app data dir unavailable
- arquivo invalido
- {}
- Could not determine data directory
- external_data_cache: failed to create
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/76e6339c66ca2773.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/src/plugin_host.rs:136
anyhow::bail!("external_data_cache: namespace must not be empty");
}
if plugin_id.contains(['/', '\\', ':', '\0']) || namespace.contains(['/', '\\', ':', '\0'])
{
anyhow::bail!(
"external_data_cache: plugin_id/namespace must not contain path separators or null bytes"
);
}
// portable installs keep every file next to the app, so the cache
// lives under the app data dir instead of the OS cache dir
let base = if std::env::var("OMNIGET_PORTABLE").is_ok() {
omniget_core::core::paths::app_data_dir()
.ok_or_else(|| anyhow::anyhow!("external_data_cache: app data dir unavailable"))?
.join("cache")
} else {
dirs::cache_dir()
.ok_or_else(|| {
anyhow::anyhow!(
"external_data_cache: OS cache dir unavailable on this platform"
)
})?
.join("wtf.tonho.omniget")
};
let dir = base.join("external-cache").join(plugin_id).join(namespace);
std::fs::create_dir_all(&dir).map_err(|e| {
anyhow::anyhow!(
"external_data_cache: failed to create {}: {}",
dir.display(),
e
)
})?;
Ok(dir)
}
fn get_cookie_file(&self, domain: &str, account: Option<&str>) -> Option<PathBuf> {
crate::cookies::account_path_for_consumer(domain, account)View on GitHub (pinned to 8600b91f42)