{"record":{"id":"7b9ac41a5f1ff489","repo":"cjpais/Handy","slug":"failed-to-initialize-model-manager","errorCode":null,"errorMessage":"Failed to initialize model manager","messagePattern":"Failed to initialize model manager","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/src/lib.rs","lineNumber":857,"sourceCode":"        .plugin(tauri_plugin_autostart::init(\n            MacosLauncher::LaunchAgent,\n            Some(vec![]),\n        ))\n        .manage(cli_args.clone())\n        .setup(move |app| {\n            specta_builder.mount_events(app);\n\n            // Headless one-shot path (`--transcribe-file` / `--list-devices` /\n            // `--list-models`): initialize only what transcription needs — the\n            // store/paths plugins, the model + transcription managers, and the\n            // transcribe-cpp backend + accelerator settings — then run on a worker\n            // thread and exit. Deliberately skips the window, tray, overlay, audio\n            // recorder (so it never opens the mic, even with always_on_microphone),\n            // signal handlers, and autostart that initialize_core_logic sets up.\n            if headless_mode {\n                let app_handle = app.handle().clone();\n                let model_manager = Arc::new(\n                    ModelManager::new(&app_handle).expect(\"Failed to initialize model manager\"),\n                );\n                let transcription_manager = Arc::new(\n                    TranscriptionManager::new(&app_handle, model_manager.clone())\n                        .expect(\"Failed to initialize transcription manager\"),\n                );\n                app_handle.manage(model_manager);\n                app_handle.manage(transcription_manager);\n                managers::transcription::init_transcribe_backend();\n                managers::transcription::apply_accelerator_settings(&app_handle);\n\n                let handle = app_handle.clone();\n                let args = cli_args.clone();\n                std::thread::spawn(move || {\n                    let code = run_headless_guarded(|| run_headless_transcription(&handle, &args));\n                    // Drop the loaded engine before teardown: ggml-metal's global\n                    // device free asserts (SIGABRT) if a model's Metal resources\n                    // are still alive at C++ static-destructor time.\n                    if let Some(tm) = handle.try_state::<Arc<TranscriptionManager>>() {","sourceCodeStart":839,"sourceCodeEnd":875,"githubUrl":"https://github.com/cjpais/Handy/blob/98a4d80cce8ad41efec2a419b59d9e81229a35d7/src-tauri/src/lib.rs#L839-L875","documentation":"Error \"Failed to initialize model manager\" thrown in cjpais/Handy.","triggerScenarios":"Thrown at src-tauri/src/lib.rs:857 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"98a4d80cce8ad41efec2a419b59d9e81229a35d7","analyzedAt":"2026-08-16T20:58:09.966Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}