{"record":{"id":"50390ba7407929b7","repo":"cjpais/Handy","slug":"failed-to-initialize-recording-manager","errorCode":null,"errorMessage":"Failed to initialize recording manager","messagePattern":"Failed to initialize recording manager","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"src-tauri/src/lib.rs","lineNumber":203,"sourceCode":"\nfn initialize_core_logic(app_handle: &AppHandle) {\n    // Note: Enigo (keyboard/mouse simulation) is NOT initialized here.\n    // The frontend is responsible for calling the `initialize_enigo` command\n    // after onboarding completes. This avoids triggering permission dialogs\n    // on macOS before the user is ready.\n\n    // Initialize the managers. The audio recorder receives the streaming router\n    // explicitly, so always-on microphone startup can wire live-preview frames\n    // even before Tauri state is populated.\n    let model_manager =\n        Arc::new(ModelManager::new(app_handle).expect(\"Failed to initialize model manager\"));\n    let transcription_manager = Arc::new(\n        TranscriptionManager::new(app_handle, model_manager.clone())\n            .expect(\"Failed to initialize transcription manager\"),\n    );\n    let recording_manager = Arc::new(\n        AudioRecordingManager::new(app_handle, transcription_manager.stream_router())\n            .expect(\"Failed to initialize recording manager\"),\n    );\n    let history_manager =\n        Arc::new(HistoryManager::new(app_handle).expect(\"Failed to initialize history manager\"));\n\n    // Initialize the transcribe-cpp native backend (logging + backend module\n    // registration) once, before any whisper model is loaded.\n    managers::transcription::init_transcribe_backend();\n\n    // Apply accelerator preferences before any model loads\n    managers::transcription::apply_accelerator_settings(app_handle);\n\n    // Add managers to Tauri's managed state\n    app_handle.manage(recording_manager.clone());\n    app_handle.manage(model_manager.clone());\n    app_handle.manage(transcription_manager.clone());\n    app_handle.manage(history_manager.clone());\n    app_handle.manage(tray::TrayState::new());\n","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/cjpais/Handy/blob/ba10ce1943ef34e93c09494027fc0b9ced2e8a44/src-tauri/src/lib.rs#L185-L221","documentation":"Startup panic when AudioRecordingManager::new returns Err. This manager wires the transcription stream router into a fresh audio recorder; failure means the audio recording subsystem could not be assembled at startup. Missing microphones do NOT fail here — device absence surfaces later at record time as 'No input device found' — so this expect indicates structural init failure.","triggerScenarios":"initialize_core_logic constructing the recording manager at launch; any fallible step inside AudioRecordingManager::new (managers/audio.rs) returning Err, such as audio toolkit initialization or thread spawn.","commonSituations":"Rare; reported in heavily sandboxed processes or containers where thread creation or audio-host initialization fails, and in custom builds that added fallible init to the recorder.","solutions":["Get the panic backtrace (RUST_BACKTRACE=1) and map it to the fallible call inside AudioRecordingManager::new","If running under a container/CI, raise process/thread limits or move to a desktop session with a functioning audio stack","Verify basic host initialization with handy --list-devices — if that also fails, the audio stack itself is broken"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// Sanity-check that the audio host initializes at all before managers depend on it\nlet host_ok = crate::audio_toolkit::get_cpal_host().default_input_device().is_some()\n    || crate::audio_toolkit::get_cpal_host().input_devices().is_ok();","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Smoke-test audio host initialization early (e.g. a --list-devices code path) and report a clear environment error before manager construction","In sandboxes/containers, verify thread limits and audio stack availability before launching"],"tags":["rust","tauri","audio","startup","panic"],"backgroundTag":"startup-manager-init-failed","analyzedSha":"ba10ce1943ef34e93c09494027fc0b9ced2e8a44","analyzedAt":"2026-08-17T10:29:55.597Z","contentChangedAt":"2026-08-17T10:29:55.597Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}