tonhowtf/omniget · error · anyhow::Error
não achei o diretório de dados do app
Error message
não achei o diretório de dados do app
What it means
Raised by install_runtime() when target_dir() returns None, i.e. the app cannot determine its per-user data directory to install the runtime into. The download pipeline cannot proceed without a destination.
Solutions
- Set HOME (and XDG_DATA_HOME on Linux) to a writable directory before launching the app
- Run the app as a normal logged-in user session, not as a system service
- Ensure the OS app-data API (Tauri path resolver) works — check app configuration/permissions
- Create the expected data directory manually and re-run
Example fix
// before cargo test ... # in CI container: "não achei o diretório de dados do app" // after env: HOME: /home/runner XDG_DATA_HOME: /home/runner/.local/share
Defensive patterns
Strategy: validation
Validate before calling
if std::env::var_os("HOME").is_none() { eprintln!("HOME must be set"); std::process::exit(1); } Type guard
fn data_dir_ready() -> bool { std::env::var_os("HOME").map(|h| std::path::PathBuf::from(h).is_dir()).unwrap_or(false) } Try / catch
match onnxrt::install_runtime(None, &progress).await { Err(e) if e.to_string().contains("diretório de dados") => fix_env_and_retry(), ... } Prevention
- Always launch the app with HOME set (services, CI)
- Set XDG_DATA_HOME explicitly in containers
- Create the app data dir during first-run setup
When it happens
Trigger: install_runtime() or install_from_path() called in an environment where the OS data-dir lookup fails: no XDG_DATA_HOME/HOME, non-standard Tauri context, sandboxed/headless environment.
Common situations: Running the Tauri app as a service with unset HOME; CI containers without user dirs; corrupted XDG configuration; running with restricted environment variables.
Related errors
- pasta de origem não encontrada
- Could not determine data directory
- escolha a pasta de saída
- not found
- app_data_dir unavailable
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/1a478f436697b9b8.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/onnxrt.rs:459
/// Baixa (conferindo o sha256), extrai e deixa a lib pronta para o `init()`.
pub async fn ensure_runtime(
variant: Option<String>,
progress: &crate::core::tools::ProgressFn,
) -> anyhow::Result<PathBuf> {
if let Some(p) = resolve_path() {
return Ok(p);
}
install_runtime(variant, progress).await
}
/// Instala mesmo que já exista — é o "atualizar" da tela de Modelos.
pub async fn install_runtime(
variant: Option<String>,
progress: &crate::core::tools::ProgressFn,
) -> anyhow::Result<PathBuf> {
let asset = pick_asset(variant.as_deref())?;
let dir = target_dir().ok_or_else(|| anyhow!("não achei o diretório de dados do app"))?;
std::fs::create_dir_all(&dir).with_context(|| format!("criando {}", dir.display()))?;
let url = format!("{}/v{}/{}", RELEASE_BASE, RUNTIME_VERSION, asset.file);
let tmp = crate::core::tools::temp_dir().join(asset.file);
let client = crate::core::tools::client()?;
crate::core::tools::download_to(&client, &url, &tmp, progress, "onnxruntime").await?;
let asset_file = asset.file.to_string();
let expected = asset.sha256.to_string();
let is_zip = asset_file.ends_with(".zip");
let dir_for_task = dir.clone();
let tmp_for_task = tmp.clone();
let p = progress.clone();
let out = tokio::task::spawn_blocking(move || -> anyhow::Result<PathBuf> {
crate::core::tools::report(
&p,
"onnxruntime",
"verify",View on GitHub (pinned to 8600b91f42)