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

Failed to query config: {}

Error message

Failed to query config: {}

What it means

Thrown by get_configured_model when the SQLx query 'SELECT provider, model FROM transcript_settings WHERE id = 1' fails to execute against the app database. This is a query-execution failure (bad connection, missing table, locked database), not a missing-row case: fetch_optional returns None for absent rows and the code then falls back to default models.

Source

Thrown at frontend/src-tauri/src/audio/import.rs:853

            Ok(e)
        }
        None => Err(anyhow!("Parakeet engine not initialized")),
    }
}

/// Get the configured model from database
async fn get_configured_model<R: Runtime>(app: &AppHandle<R>, provider_type: &str) -> Result<String> {
    let app_state = app
        .try_state::<AppState>()
        .ok_or_else(|| anyhow!("App state not available"))?;

    let result: Option<(String, String)> = sqlx::query_as(
        "SELECT provider, model FROM transcript_settings WHERE id = '1'",
    )
    .fetch_optional(app_state.db_manager.pool())
    .await
    .map_err(|e| anyhow!("Failed to query config: {}", e))?;

    match result {
        Some((provider, model)) => {
            if (provider_type == "whisper" && (provider == "localWhisper" || provider == "whisper"))
                || (provider_type == "parakeet" && provider == "parakeet")
            {
                Ok(model)
            } else {
                // Return default model for the requested type
                Ok(if provider_type == "parakeet" {
                    DEFAULT_PARAKEET_MODEL.to_string()
                } else {
                    DEFAULT_WHISPER_MODEL.to_string()
                })
            }
        }
        None => Ok(if provider_type == "parakeet" {
            DEFAULT_PARAKEET_MODEL.to_string()

View on GitHub (pinned to 0281737d87)

Solutions

  1. Ensure database migrations run at app startup before any import path executes
  2. Close other app instances or processes holding the database file
  3. Read the sqlx error text in the log: 'no such table' means missing migration, 'database is locked' means contention, 'unable to open database file' means path/permissions
  4. If the database is corrupted, recreate it in the app data directory (transcript settings revert to defaults)

Example fix

// before
.map_err(|e| anyhow!("Failed to query config: {}", e))?;

// after - name the table and row so the log is diagnosable
.map_err(|e| anyhow!("Failed to query transcript_settings (id=1) for provider {}: {}", provider_type, e))?
Defensive patterns

Strategy: fallback

Validate before calling

// Pre-flight before audio import: prove the settings table is queryable
async fn transcript_settings_ready(pool: &sqlx::SqlitePool) -> Result<(), anyhow::Error> {
    sqlx::query("SELECT provider, model FROM transcript_settings WHERE id = '1'")
        .fetch_optional(pool)
        .await
        .map(|_| ())
        .map_err(|e| anyhow::anyhow!("transcript_settings not queryable: {}", e))
}

Try / catch

Match the error; on failure log a warning and fall back to the same defaults used for a missing row (DEFAULT_PARAKEET_MODEL / whisper default) instead of aborting the import.

Prevention

When it happens

Trigger: Running audio import when the transcript_settings table does not exist (migrations never ran), the SQLite database file is locked by another writer, the database file was deleted or moved while the app was running, or the db_manager connection pool is closed or broken.

Common situations: App upgraded without running database migrations; two app instances (e.g., a debug build and a release build) contending for the same SQLite file; disk-full causing SQLite I/O errors; corrupted database file.

Related errors


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