tonhowtf/omniget · error
Could not determine data directory
Error message
Could not determine data directory
What it means
upscale::install() first resolves the managed tools directory via managed_dir(). If that returns None — meaning the application could not locate or create its per-user data directory — install aborts with this error before contacting GitHub. It indicates the environment lacks a resolvable data directory (e.g. no HOME/XDG_DATA_HOME/APPDATA).
Solutions
- Set the appropriate environment variable (HOME on Linux/macOS, APPDATA on Windows) before launching the app
- Run the app as a normal desktop user rather than a service account without a home directory
- Check managed_dir()'s implementation to see which directories it probes and create the expected directory manually
- Pass an explicit data directory through configuration if the code supports overriding it
Example fix
// before HOME= ./myapp // after export HOME=/home/user && ./myapp
Defensive patterns
Strategy: fallback
Validate before calling
fn has_data_dir() -> bool {
std::env::var_os("HOME").is_some()
|| std::env::var_os("APPDATA").is_some()
|| std::env::var_os("XDG_DATA_HOME").is_some()
} Try / catch
match upscale::install(&progress).await {
Err(e) if e.to_string().contains("data directory") => {
eprintln!("Configure HOME ou APPDATA e reinicie.");
}
other => other,
} Prevention
- Launch the app with HOME/APPDATA set (avoid bare service contexts)
- Prefer normal desktop sessions over stripped systemd/container environments
- Probe managed_dir() at startup and fail fast with a user-friendly message
When it happens
Trigger: Calling install() on a system where managed_dir() returns None: HOME unset, XDG_DATA_HOME pointing nowhere writable, no APPDATA on Windows, or the data root could not be determined at all.
Common situations: Running inside a container or systemd service without HOME set; portable deployments with stripped environment; nonstandard OS layouts; CI sandboxes.
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
- Could not determine data directory
- binario sumiu apos instalar
- Could not determine data directory
- pasta de origem não encontrada
- Cannot determine app data directory
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/49d2cb2701be60f0.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/upscale.rs:81
path: None,
models: vec![],
},
}
}
fn asset_pick(name: &str) -> bool {
let os = if cfg!(target_os = "windows") {
"windows"
} else if cfg!(target_os = "macos") {
"macos"
} else {
"ubuntu"
};
name.starts_with("realesrgan-ncnn-vulkan") && name.contains(os) && name.ends_with(".zip")
}
pub async fn install(progress: super::ProgressFn) -> anyhow::Result<String> {
let dir = managed_dir().ok_or_else(|| anyhow!("Could not determine data directory"))?;
let client = github::client()?;
let asset = github::asset(&client, REPO, None, asset_pick).await?;
// Release de 2022: a API não tem digest para esses assets.
let data = github::download(&client, &asset, true, &progress, BIN).await?;
let staging = dir.with_extension("new");
let _ = std::fs::remove_dir_all(&staging);
let (s2, n2) = (staging.clone(), asset.name.clone());
tokio::task::spawn_blocking(move || github::unpack(&data, &n2, &s2))
.await
.map_err(|e| anyhow!("Spawn blocking failed: {}", e))??;
let Some(exe) = github::find_file(&staging, &bin_name(BIN)) else {
let _ = std::fs::remove_dir_all(&staging);
return Err(anyhow!("o pacote nao contem o {}", BIN));
};
github::make_executable(&exe);
github::swap_dir(&staging, &dir)?;
github::strip_quarantine(&dir).await;
locate()View on GitHub (pinned to 8600b91f42)