{"record":{"id":"b34b7e81534144f5","repo":"Zackriya-Solutions/meetily","slug":"import-cancelled","errorCode":null,"errorMessage":"Import cancelled","messagePattern":"Import cancelled","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"info","filePath":"frontend/src-tauri/src/audio/import.rs","lineNumber":338,"sourceCode":"\n    // Validate source file\n    if !source.exists() {\n        return Err(anyhow!(\"Source file not found: {}\", source.display()));\n    }\n\n    info!(\n        \"Starting import for '{}' from {} with language {:?}, model {:?}, provider {:?}\",\n        title, source_path, language, model, provider\n    );\n\n    // Determine which provider to use (default to whisper)\n    let use_parakeet = provider.as_deref() == Some(\"parakeet\");\n\n    emit_progress(&app, \"copying\", 5, \"Creating meeting folder...\");\n\n    // Check for cancellation\n    if IMPORT_CANCELLED.load(Ordering::SeqCst) {\n        return Err(anyhow!(\"Import cancelled\"));\n    }\n\n    // Create meeting folder\n    let base_folder = get_default_recordings_folder();\n    let meeting_folder = create_meeting_folder(&base_folder, &title, false)?;\n\n    // Copy audio file to meeting folder\n    emit_progress(&app, \"copying\", 10, \"Copying audio file...\");\n\n    let dest_filename = format!(\n        \"audio.{}\",\n        source\n            .extension()\n            .and_then(|e| e.to_str())\n            .unwrap_or(\"mp4\")\n    );\n    let dest_path = meeting_folder.join(&dest_filename);\n","sourceCodeStart":320,"sourceCodeEnd":356,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/0281737d87d26352fb0adc78c8c0975f691b23d1/frontend/src-tauri/src/audio/import.rs#L320-L356","documentation":"First cancellation checkpoint in run_import (import.rs:338): the global IMPORT_CANCELLED flag was set (by cancel_import, invoked from the frontend cancel control) before the meeting folder was created, so the import aborts with this sentinel error. It is control flow, not a malfunction - the same string is used at every checkpoint (lines 338, 370, ~400, ~426) so the UI can recognize cancellation uniformly. Because the check sits before create_meeting_folder, no artifacts exist yet on this path.","triggerScenarios":"User clicks Cancel during the early copying stage before the folder exists; a frontend timeout/abort controller calls the cancel command; double-firing start_import where the UI cancels the stale one; any other window calling cancel_import (the flag is process-global).","commonSituations":"User picks the wrong file and cancels immediately; slow disk makes Creating-meeting-folder linger and the user bails; automated flows cancelling long imports on navigation.","solutions":["No fix needed for the error itself - verify the UI treats 'Import cancelled' as an info state (dismiss, return to picker), not a red error toast.","If cancellation was unexpected, check for stray cancel_import invokes in the frontend (unmount handlers, abort controllers, dev double-mounts of React effects).","If cancellation seems impossible yet occurs, remember IMPORT_CANCELLED is process-global: a cancel in any window cancels imports in all of them.","Callers that auto-retry on Err must exclude this sentinel - retrying a user-cancelled import is wrong.","For cleaner matching, compare on a typed flag or distinct error kind rather than string equality."],"exampleFix":"// frontend: before - every failure shown as an error\nawait invoke('import_audio_file', ...).catch(e => showError(e));\n\n// frontend: after - recognize the cancellation sentinel\nawait invoke('import_audio_file', ...).catch(e => {\n  if (String(e).includes('Import cancelled')) setStatus('cancelled');\n  else showError(e);\n});","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Recognize the sentinel and treat as info, not failure\ntry { await invoke('import_audio_file', payload); }\ncatch (e) {\n  const msg = String(e);\n  if (msg.includes('Import cancelled')) setStatus('cancelled');\n  else showError(msg);\n}","preventionTips":["Distinguish the 'Import cancelled' sentinel from real errors in every catch site.","Bind the Cancel button to cancel_import and disable it once a terminal state arrives.","Audit unmount/abort handlers for stray cancel_import calls.","Do not auto-retry cancellations - only explicit user action restarts an import."],"tags":["import","cancellation","control-flow","user-action"],"backgroundTag":"operation-cancelled","analyzedSha":"0281737d87d26352fb0adc78c8c0975f691b23d1","analyzedAt":"2026-08-16T20:57:52.567Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}