{"record":{"id":"8d99b7c1ae414199","repo":"Zackriya-Solutions/meetily","slug":"recording-not-active","errorCode":null,"errorMessage":"Recording not active","messagePattern":"Recording not active","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"warning","filePath":"frontend/src-tauri/src/audio/recording_commands.rs","lineNumber":1197,"sourceCode":"        _ => return Err(format!(\"Invalid device type: {}\", device_type)),\n    };\n\n    // Check if recording is active\n    {\n        let manager_guard = RECORDING_MANAGER.lock().unwrap();\n        if manager_guard.is_none() {\n            return Err(\"Recording not active\".to_string());\n        }\n    } // Release lock\n\n    // Spawn blocking task to handle the async reconnection\n    let result = tokio::task::spawn_blocking(move || {\n        tokio::runtime::Handle::current().block_on(async {\n            let mut manager_guard = RECORDING_MANAGER.lock().unwrap();\n            if let Some(manager) = manager_guard.as_mut() {\n                manager.attempt_device_reconnect(&device_name, monitor_type).await\n            } else {\n                Err(anyhow::anyhow!(\"Recording not active\"))\n            }\n        })\n    })\n    .await\n    .map_err(|e| format!(\"Task join error: {}\", e))?;\n\n    match result {\n        Ok(success) => {\n            if success {\n                info!(\"✅ Manual reconnection successful\");\n            } else {\n                warn!(\"❌ Manual reconnection failed - device not available\");\n            }\n            Ok(success)\n        }\n        Err(e) => {\n            error!(\"Manual reconnection error: {}\", e);\n            Err(e.to_string())","sourceCodeStart":1179,"sourceCodeEnd":1215,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/0281737d87d26352fb0adc78c8c0975f691b23d1/frontend/src-tauri/src/audio/recording_commands.rs#L1179-L1215","documentation":"The attempt_device_reconnect Tauri command requires an active recording: the global RECORDING_MANAGER must contain a manager. The error fires from either the fast pre-check before spawn_blocking or the check inside block_on, and means recording was never started or has already been torn down.","triggerScenarios":"Frontend fires attempt_device_reconnect after a disconnect flow already stopped the recording; user clicks Reconnect after clicking Stop; UI recording state is stale because it missed a recording-stopped event; command invoked from a script outside a live session.","commonSituations":"Bluetooth device loss triggers auto-stop but the UI still shows a Reconnect button; rapid stop-then-reconnect race; frontend state cached across meeting switches.","solutions":["Drive Reconnect button visibility from backend recording-state events or the is_recording command, not cached frontend state","If the recording already stopped, call start_recording again instead of attempt_device_reconnect","Poll get_reconnection_status before invoking the manual reconnect to confirm a live session"],"exampleFix":"// before (frontend)\nawait invoke('attempt_device_reconnect', { deviceName, monitorType });\n\n// after - confirm a live recording first\nif (!(await invoke<boolean>('is_recording'))) {\n  showToast('Recording has stopped - start a new recording instead');\n  return;\n}\nawait invoke('attempt_device_reconnect', { deviceName, monitorType });","handlingStrategy":"validation","validationCode":"// Frontend: confirm a live recording before manual reconnect\nconst recording = await invoke<boolean>('is_recording');\nif (!recording) {\n  // hide Reconnect, offer Start Recording instead\n}","typeGuard":null,"tryCatchPattern":"Catch the 'Recording not active' string error from the invoke and map it to a UI hint ('Recording has stopped - start a new recording'), not a generic failure toast.","preventionTips":["Drive Reconnect availability from get_reconnection_status / is_recording commands or backend events, not cached frontend state","On recording-stopped events, immediately clear any reconnect affordance from the UI","After a device-disconnect auto-stop, prefer a fresh start_recording over reconnect commands"],"tags":["recording","state-machine","race-condition","tauri-command","reconnect"],"backgroundTag":"invalid-state-operation","analyzedSha":"0281737d87d26352fb0adc78c8c0975f691b23d1","analyzedAt":"2026-08-16T20:57:52.567Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}