{"record":{"id":"791f139d54f2fd6b","repo":"Zackriya-Solutions/meetily","slug":"db-error","errorCode":null,"errorMessage":"DB error: {}","messagePattern":"DB error: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src-tauri/src/audio/import.rs","lineNumber":700,"sourceCode":"            progress_percentage: progress,\n            message: message.to_string(),\n        },\n    );\n}\n\n\n/// Create a new meeting with transcripts in the database\nasync fn create_meeting_with_transcripts(\n    pool: &sqlx::SqlitePool,\n    title: &str,\n    segments: &[TranscriptSegment],\n    folder_path: String,\n) -> Result<String> {\n    let meeting_id = format!(\"meeting-{}\", Uuid::new_v4());\n    let now = chrono::Utc::now();\n\n    // Start transaction\n    let mut conn = pool.acquire().await.map_err(|e| anyhow!(\"DB error: {}\", e))?;\n    let mut tx = sqlx::Connection::begin(&mut *conn)\n        .await\n        .map_err(|e| anyhow!(\"Failed to start transaction: {}\", e))?;\n\n    // Insert meeting\n    sqlx::query(\n        \"INSERT INTO meetings (id, title, created_at, updated_at, folder_path)\n         VALUES (?, ?, ?, ?, ?)\",\n    )\n    .bind(&meeting_id)\n    .bind(title)\n    .bind(now)\n    .bind(now)\n    .bind(&folder_path)\n    .execute(&mut *tx)\n    .await\n    .map_err(|e| anyhow!(\"Failed to create meeting: {}\", e))?;\n","sourceCodeStart":682,"sourceCodeEnd":718,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/0281737d87d26352fb0adc78c8c0975f691b23d1/frontend/src-tauri/src/audio/import.rs#L682-L718","documentation":"`pool.acquire()` failed before any SQL executed. sqlx surfaces two main kinds here: PoolTimedOut (every connection in the SQLite pool was checked out longer than acquire_timeout, default 30s) and PoolClosed (the pool was closed, typically during app shutdown while the import was still saving). The {} carries that underlying sqlx error.","triggerScenarios":"The import reaches the 'saving' stage (85%) while other long-running DB operations hold all pool connections; the app quits and closes the pool mid-import; or the SQLite file/directory becomes unreadable so new connections fail.","commonSituations":"Importing while a meeting summary or history query runs; many concurrent Tauri commands sharing a small pool; app exit before async tasks finish; DB file permissions changed by backup software.","solutions":["Read the sqlx error kind in the {} — PoolTimedOut and PoolClosed have opposite fixes","For PoolTimedOut: raise max_connections and acquire_timeout in the PoolOptions used by db_manager","For PoolClosed: keep the import task alive until completion (await its handle before closing the pool at shutdown)","Enable WAL journal and busy_timeout on connect so writers queue less"],"exampleFix":"// before\nlet mut conn = pool.acquire().await.map_err(|e| anyhow!(\"DB error: {}\", e))?;\n\n// after — retry transient pool exhaustion with backoff\nlet mut conn = loop {\n    match pool.acquire().await {\n        Ok(c) => break c,\n        Err(e) if retries < 3 && e.to_string().contains(\"timed out\") => {\n            retries += 1;\n            tokio::time::sleep(std::time::Duration::from_millis(500)).await;\n        }\n        Err(e) => return Err(anyhow!(\"DB error: {}\", e)),\n    }\n};","handlingStrategy":"retry","validationCode":"// size the pool for concurrent DB users at startup\nSqlitePoolOptions::new()\n    .max_connections(8)\n    .acquire_timeout(Duration::from_secs(60))\n    .connect(&db_url)\n    .await?","typeGuard":null,"tryCatchPattern":"Retry pool.acquire() up to 3 times with 500ms backoff when the sqlx error is a timeout; fail immediately on PoolClosed since retrying a closed pool never succeeds.","preventionTips":["Raise max_connections/acquire_timeout if imports coincide with heavy DB features","Await in-flight import tasks before closing the pool at app shutdown","Watch for other processes locking the SQLite file (backup tools, second instance)"],"tags":["sqlx","sqlite","connection-pool","pool-timeout","rust"],"backgroundTag":"pool-acquire-timeout","analyzedSha":"0281737d87d26352fb0adc78c8c0975f691b23d1","analyzedAt":"2026-08-16T20:57:52.567Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}