{"record":{"id":"420b8dbcc4770ff9","repo":"Zackriya-Solutions/meetily","slug":"failed-to-insert-transcript","errorCode":null,"errorMessage":"Failed to insert transcript: {}","messagePattern":"Failed to insert transcript: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src-tauri/src/audio/import.rs","lineNumber":734,"sourceCode":"    .await\n    .map_err(|e| anyhow!(\"Failed to create meeting: {}\", e))?;\n\n    // Insert transcripts\n    for segment in segments {\n        sqlx::query(\n            \"INSERT INTO transcripts (id, meeting_id, transcript, timestamp, audio_start_time, audio_end_time, duration)\n             VALUES (?, ?, ?, ?, ?, ?, ?)\",\n        )\n        .bind(&segment.id)\n        .bind(&meeting_id)\n        .bind(&segment.text)\n        .bind(&segment.timestamp)\n        .bind(segment.audio_start_time)\n        .bind(segment.audio_end_time)\n        .bind(segment.duration)\n        .execute(&mut *tx)\n        .await\n        .map_err(|e| anyhow!(\"Failed to insert transcript: {}\", e))?;\n    }\n\n    tx.commit()\n        .await\n        .map_err(|e| anyhow!(\"Failed to commit transaction: {}\", e))?;\n\n    info!(\n        \"Created meeting '{}' with {} transcripts\",\n        meeting_id,\n        segments.len()\n    );\n\n    Ok(meeting_id)\n}\n\n/// Get or initialize the Whisper engine\nasync fn get_or_init_whisper<R: Runtime>(\n    app: &AppHandle<R>,","sourceCodeStart":716,"sourceCodeEnd":752,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/0281737d87d26352fb0adc78c8c0975f691b23d1/frontend/src-tauri/src/audio/import.rs#L716-L752","documentation":"One of the per-segment INSERT INTO transcripts statements failed; the loop runs once per transcript, so a single bad segment aborts the import after all transcription work completed. The {} names the SQLite cause: schema drift on the transcripts table, a constraint violation (NOT NULL on timestamp/duration/text), or a disk I/O error.","triggerScenarios":"The transcripts table missing or missing columns after schema drift; a segment carrying NULL or NaN in timestamp/audio_start_time/audio_end_time/duration from create_transcript_segments edge cases; disk filling up partway through the insert loop.","commonSituations":"Mixed app versions sharing one database; degenerate segments after silence-splitting producing non-finite durations; very long imports exhausting disk mid-loop.","solutions":["Read the {} — 'no such column' indicates schema drift, 'constraint failed' names the column with bad data","Validate segments before the DB call: non-empty text and finite numeric fields on every segment","Re-run migrations and verify PRAGMA table_info(transcripts) matches the INSERT column list","Log the failing segment id and fields when mapping the error so the bad row is identifiable"],"exampleFix":"// before — any bad segment aborts the import late\n.execute(&mut *tx).await\n    .map_err(|e| anyhow!(\"Failed to insert transcript: {}\", e))?;\n\n// after — validate segment data before inserting\nfor segment in segments {\n    if segment.text.trim().is_empty() {\n        warn!(\"skipping empty segment {}\", segment.id);\n        continue;\n    }\n    if !segment.duration.is_finite() || !segment.audio_start_time.is_finite() {\n        warn!(\"segment {} has non-finite times, skipping\", segment.id);\n        continue;\n    }\n    // ...bind and execute\n}","handlingStrategy":"validation","validationCode":"// validate every segment before the DB write\nfn segments_writable(segments: &[TranscriptSegment]) -> bool {\n    segments.iter().all(|s| {\n        !s.text.trim().is_empty()\n            && s.duration.is_finite()\n            && s.audio_start_time.is_finite()\n            && s.audio_end_time.is_finite()\n    })\n}","typeGuard":null,"tryCatchPattern":"Wrap the per-segment insert: on error, log the failing segment.id and its field values, then decide — skip that row and continue inside the transaction for data errors; abort only for schema/I-O errors.","preventionTips":["Assert finite numeric fields when creating segments (NaN durations from silence-splitting are the usual culprit)","Keep app versions from sharing one DB file across schema changes","Verify PRAGMA table_info(transcripts) after migrations"],"tags":["sqlx","sqlite","insert","transcripts","schema","rust"],"backgroundTag":"database-insert-failed","analyzedSha":"0281737d87d26352fb0adc78c8c0975f691b23d1","analyzedAt":"2026-08-16T20:57:52.567Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}