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

Failed to save store to disk: {}

Error message

Failed to save store to disk: {}

What it means

store.save() failed while flushing recording_preferences.json to disk in the app data directory. The in-memory store was updated but the filesystem write failed - a plain I/O error such as ENOSPC, EACCES, or a lock held by another process.

Source

Thrown at frontend/src-tauri/src/audio/recording_preferences.rs:161

          preferences.save_folder, preferences.auto_save, preferences.file_format,
          preferences.preferred_mic_device, preferences.preferred_system_device);

    // Get or create store
    let store = app
        .store("recording_preferences.json")
        .map_err(|e| anyhow::anyhow!("Failed to access store: {}", e))?;

    // Serialize preferences to JSON value
    let prefs_value = serde_json::to_value(preferences)
        .map_err(|e| anyhow::anyhow!("Failed to serialize preferences: {}", e))?;

    // Save to store
    store.set("preferences", prefs_value);

    // Persist to disk
    store
        .save()
        .map_err(|e| anyhow::anyhow!("Failed to save store to disk: {}", e))?;

    info!("Successfully persisted recording preferences to disk");

    // Save backend preference to global config
    #[cfg(target_os = "macos")]
    if let Some(backend_str) = &preferences.system_audio_backend {
        if let Some(backend) = AudioCaptureBackend::from_string(backend_str) {
            info!("Setting audio capture backend to: {:?}", backend);
            crate::audio::capture::set_current_backend(backend);
        }
    }

    // Ensure the directory exists
    ensure_recordings_directory(&preferences.save_folder)?;

    Ok(())
}

View on GitHub (pinned to 0281737d87)

Solutions

  1. Free disk space and retry saving preferences
  2. Verify the app data folder is writable and owned by the running user
  3. Exclude the app data directory from cloud-sync and antivirus real-time scanning
  4. Avoid running two app instances that persist the same store file

Example fix

// before
store
    .save()
    .map_err(|e| anyhow::anyhow!("Failed to save store to disk: {}", e))?;

// after - one bounded retry for transient locks, then surface a clear error
let mut attempt = 0;
loop {
    match store.save() {
        Ok(_) => break,
        Err(e) if attempt < 2 => {
            attempt += 1;
            warn!("Store save failed (attempt {}): {}", attempt, e);
            std::thread::sleep(std::time::Duration::from_millis(250));
        }
        Err(e) => return Err(anyhow::anyhow!("Failed to save store to disk after retries: {}", e)),
    }
}
Defensive patterns

Strategy: retry

Validate before calling

// Pre-save checks: writable directory and free space
let dir = app.path().app_data_dir()?;
let meta = std::fs::metadata(&dir)?;
if meta.permissions().readonly() { /* surface config error before saving */ }

Try / catch

Retry store.save() up to 2-3 times with short backoff (locks from AV/sync are transient); on final failure keep the in-memory value, warn, and retry on next preferences change or app exit.

Prevention

When it happens

Trigger: Disk full; the app data directory or store file was made read-only (permissions change, sandbox); the file is momentarily locked by antivirus or cloud-sync (OneDrive, Dropbox) during write; the directory was deleted while the app was running.

Common situations: Full disks on meeting machines; corporate endpoint protection scanning app-data files; two app instances writing the same store concurrently; portable apps run from read-only media.

Related errors


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