tonhowtf/omniget · error · anyhow::Error
Could not determine data directory
Error message
Could not determine data directory
What it means
download_ffmpeg() resolves the directory where FFmpeg binaries are installed via managed_bin_dir(). When that helper returns None — typically because the app data directory cannot be resolved (no home directory, missing XDG/app-data environment, or unsupported platform layout) — the code converts it to this anyhow error with the ? operator and aborts the download.
Solutions
- Ensure the process runs with a valid HOME/user profile (or set XDG_DATA_HOME) before invoking ensure_ffmpeg/update_ffmpeg
- Check managed_bin_dir() to see which lookup fails and fix the environment or hardcode a fallback directory
- Run the app as a normal user rather than as root/service without a home directory
- Verify the target platform is supported by the data-dir resolution logic
Example fix
// before
let bin_dir = managed_bin_dir().ok_or_else(|| anyhow!("Could not determine data directory"))?;
// after
let bin_dir = managed_bin_dir().unwrap_or_else(|| {
dirs::data_dir().unwrap_or_else(|| std::env::temp_dir().join("omniget"))
}); Defensive patterns
Strategy: validation
Validate before calling
if managed_bin_dir().is_none() {
eprintln!("No data directory available; set HOME or XDG_DATA_HOME before installing FFmpeg");
return;
} Type guard
fn has_data_dir() -> bool { managed_bin_dir().is_some() } Try / catch
match download_ffmpeg().await {
Ok(path) => println!("installed at {}", path.display()),
Err(e) if e.to_string().contains("data directory") => configure_data_dir_and_retry(),
Err(e) => eprintln!("ffmpeg install failed: {e}"),
} Prevention
- Never run the app as a service without a home directory; set HOME/XDG equivalents explicitly
- Add a fallback data-dir (temp dir) inside managed_bin_dir
- Log the failing lookup inside managed_bin_dir so the cause is visible
- Check data-dir availability at app startup, before first install
When it happens
Trigger: Calling ensure_ffmpeg() or update_ffmpeg() on a system where managed_bin_dir() yields None: HOME unset, no writable app-data directory, or an embedded/nonstandard runtime where the data-dir lookup fails.
Common situations: Running the app as a system service with no HOME set; sandboxed/CI environments without a user profile; unusual platform builds where the Tauri app-data path is unavailable.
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
- não achei o diretório de dados do app
- escolha a pasta de saída
- pasta de origem não encontrada
- No downloadable media found for this tweet (it may be…
- Download cancelado
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/34285fcb8f0e5eeb.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/dependencies.rs:400
crate::core::ytdlp::reset_ffmpeg_location_cache();
return Ok(path);
}
}
}
if let Some(path) = find_tool("ffmpeg").await {
return Ok(path);
}
if is_flatpak() {
return Err(anyhow!("FFmpeg not found in Flatpak sandbox"));
}
let path = download_ffmpeg().await?;
crate::core::ytdlp::reset_ffmpeg_location_cache();
Ok(path)
}
async fn download_ffmpeg() -> anyhow::Result<PathBuf> {
let bin_dir = managed_bin_dir().ok_or_else(|| anyhow!("Could not determine data directory"))?;
std::fs::create_dir_all(&bin_dir)?;
let ffmpeg_name = bin_name("ffmpeg");
let ffprobe_name = bin_name("ffprobe");
let ffmpeg_target = bin_dir.join(&ffmpeg_name);
let downloads = ffmpeg_download_urls();
let client = crate::core::http_client::apply_global_proxy(reqwest::Client::builder())
.timeout(std::time::Duration::from_secs(300))
.build()?;
for (url, archive_type) in downloads {
tracing::info!("Downloading FFmpeg component from {}", url);
let response = client.get(url).send().await?;
if !response.status().is_success() {
return Err(anyhow!(
"Failed to download FFmpeg from {}: HTTP {}",View on GitHub (pinned to 8600b91f42)