Zackriya-Solutions/meetily · error · anyhow::Error

Could not find system data directory

Error message

Could not find system data directory

What it means

In release builds, ParakeetEngine::new_with_models_dir's default-location fallback found neither dirs::data_dir() nor dirs::home_dir(), so it cannot construct the models path (Meetily/models/parakeet). Both lookups depend on the environment/home being resolvable; when they are not, path resolution is impossible.

Source

Thrown at frontend/src-tauri/src/parakeet_engine/parakeet_engine.rs:141

impl ParakeetEngine {
    /// Create a new Parakeet engine with optional custom models directory
    pub fn new_with_models_dir(models_dir: Option<PathBuf>) -> Result<Self> {
        let models_dir = if let Some(dir) = models_dir {
            dir.join("parakeet") // Parakeet models in subdirectory
        } else {
            // Fallback to default location
            let current_dir = std::env::current_dir()
                .map_err(|e| anyhow!("Failed to get current directory: {}", e))?;

            if cfg!(debug_assertions) {
                // Development mode
                current_dir.join("models").join("parakeet")
            } else {
                // Production mode
                dirs::data_dir()
                    .or_else(|| dirs::home_dir())
                    .ok_or_else(|| anyhow!("Could not find system data directory"))?
                    .join("Meetily")
                    .join("models")
                    .join("parakeet")
            }
        };

        log::info!("ParakeetEngine using models directory: {}", models_dir.display());

        // Create directory if it doesn't exist
        if !models_dir.exists() {
            std::fs::create_dir_all(&models_dir)?;
        }

        Ok(Self {
            models_dir,
            current_model: Arc::new(RwLock::new(None)),
            current_model_name: Arc::new(RwLock::new(None)),
            available_models: Arc::new(RwLock::new(HashMap::new())),

View on GitHub (pinned to 0281737d87)

Solutions

  1. Set HOME (and XDG_DATA_HOME) in the launching service/launchd unit
  2. Pass an explicit models_dir resolved from the Tauri app handle (app.path().app_data_dir()) so this fallback is never exercised
  3. On Windows, verify the user profile and Known Folders resolve (run from a normal login session)

Example fix

// before
dirs::data_dir()
    .or_else(|| dirs::home_dir())
    .ok_or_else(|| anyhow!("Could not find system data directory"))?
    .join("Meetily").join("models").join("parakeet")

// after - caller passes an explicit dir resolved from the Tauri handle
let models_dir = app.path().app_data_dir()
    .map_err(|e| anyhow!("Could not resolve app data dir: {e}"))?
    .join("models");
let engine = ParakeetEngine::new_with_models_dir(Some(models_dir))?;
Defensive patterns

Strategy: validation

Validate before calling

fn data_dir_resolvable() -> bool {
    dirs::data_dir().is_some() || dirs::home_dir().is_some()
}

Prevention

When it happens

Trigger: Running the packaged app from a context without HOME/XDG_DATA_HOME (launchd/systemd services with a stripped environment), or a Windows session whose user profile did not load.

Common situations: Auto-launch daemons; kiosk/service-style deployments; unusual sandboxed runtimes.

Related errors


AI-assisted analysis of Zackriya-Solutions/meetily@0281737d87 (2026-08-16). Data as JSON: /api/errors/ecbe3bb189c9155a. Report an issue: GitHub.