{"record":{"id":"e170d171781103fb","repo":"Zackriya-Solutions/meetily","slug":"failed-to-query-config","errorCode":null,"errorMessage":"Failed to query config: {}","messagePattern":"Failed to query config: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"frontend/src-tauri/src/audio/import.rs","lineNumber":853,"sourceCode":"\n            Ok(e)\n        }\n        None => Err(anyhow!(\"Parakeet engine not initialized\")),\n    }\n}\n\n/// Get the configured model from database\nasync fn get_configured_model<R: Runtime>(app: &AppHandle<R>, provider_type: &str) -> Result<String> {\n    let app_state = app\n        .try_state::<AppState>()\n        .ok_or_else(|| anyhow!(\"App state not available\"))?;\n\n    let result: Option<(String, String)> = sqlx::query_as(\n        \"SELECT provider, model FROM transcript_settings WHERE id = '1'\",\n    )\n    .fetch_optional(app_state.db_manager.pool())\n    .await\n    .map_err(|e| anyhow!(\"Failed to query config: {}\", e))?;\n\n    match result {\n        Some((provider, model)) => {\n            if (provider_type == \"whisper\" && (provider == \"localWhisper\" || provider == \"whisper\"))\n                || (provider_type == \"parakeet\" && provider == \"parakeet\")\n            {\n                Ok(model)\n            } else {\n                // Return default model for the requested type\n                Ok(if provider_type == \"parakeet\" {\n                    DEFAULT_PARAKEET_MODEL.to_string()\n                } else {\n                    DEFAULT_WHISPER_MODEL.to_string()\n                })\n            }\n        }\n        None => Ok(if provider_type == \"parakeet\" {\n            DEFAULT_PARAKEET_MODEL.to_string()","sourceCodeStart":835,"sourceCodeEnd":871,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/0281737d87d26352fb0adc78c8c0975f691b23d1/frontend/src-tauri/src/audio/import.rs#L835-L871","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure database migrations run at app startup before any import path executes","Close other app instances or processes holding the database file","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","If the database is corrupted, recreate it in the app data directory (transcript settings revert to defaults)"],"exampleFix":"// before\n.map_err(|e| anyhow!(\"Failed to query config: {}\", e))?;\n\n// after - name the table and row so the log is diagnosable\n.map_err(|e| anyhow!(\"Failed to query transcript_settings (id=1) for provider {}: {}\", provider_type, e))?","handlingStrategy":"fallback","validationCode":"// Pre-flight before audio import: prove the settings table is queryable\nasync fn transcript_settings_ready(pool: &sqlx::SqlitePool) -> Result<(), anyhow::Error> {\n    sqlx::query(\"SELECT provider, model FROM transcript_settings WHERE id = '1'\")\n        .fetch_optional(pool)\n        .await\n        .map(|_| ())\n        .map_err(|e| anyhow::anyhow!(\"transcript_settings not queryable: {}\", e))\n}","typeGuard":null,"tryCatchPattern":"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.","preventionTips":["Run sqlx migrations during app startup, before any feature that reads transcript_settings","Enable WAL journal mode on the SQLite connection to reduce 'database is locked' under concurrent access","Run only one app instance against the same database file","Log the full sqlx error string so missing-table vs locked-db is distinguishable in the field"],"tags":["database","sqlx","sqlite","transcript-settings","audio-import"],"backgroundTag":"database-query-failed","analyzedSha":"0281737d87d26352fb0adc78c8c0975f691b23d1","analyzedAt":"2026-08-16T20:57:52.567Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}