{"record":{"id":"04096e15bd23b1de","repo":"cjpais/Handy","slug":"failed-to-load-moonshine-streaming-model","errorCode":null,"errorMessage":"Failed to load moonshine streaming model {}: {}","messagePattern":"Failed to load moonshine streaming model (.+?): (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/src/managers/transcription.rs","lineNumber":644,"sourceCode":"                    MoonshineVariant::Base,\n                    &Quantization::default(),\n                )\n                .map_err(|e| {\n                    let error_msg = format!(\"Failed to load moonshine model {}: {}\", model_id, e);\n                    emit_loading_failed(&error_msg);\n                    anyhow::anyhow!(error_msg)\n                })?;\n                LoadedEngine::Moonshine(engine)\n            }\n            EngineType::MoonshineStreaming => {\n                let engine = StreamingModel::load(&model_path, 0, &Quantization::default())\n                    .map_err(|e| {\n                        let error_msg = format!(\n                            \"Failed to load moonshine streaming model {}: {}\",\n                            model_id, e\n                        );\n                        emit_loading_failed(&error_msg);\n                        anyhow::anyhow!(error_msg)\n                    })?;\n                LoadedEngine::MoonshineStreaming(engine)\n            }\n            EngineType::SenseVoice => {\n                let engine =\n                    SenseVoiceModel::load(&model_path, &Quantization::Int8).map_err(|e| {\n                        let error_msg =\n                            format!(\"Failed to load SenseVoice model {}: {}\", model_id, e);\n                        emit_loading_failed(&error_msg);\n                        anyhow::anyhow!(error_msg)\n                    })?;\n                LoadedEngine::SenseVoice(engine)\n            }\n            EngineType::GigaAM => {\n                let engine = GigaAMModel::load(&model_path, &Quantization::Int8).map_err(|e| {\n                    let error_msg = format!(\"Failed to load gigaam model {}: {}\", model_id, e);\n                    emit_loading_failed(&error_msg);\n                    anyhow::anyhow!(error_msg)","sourceCodeStart":626,"sourceCodeEnd":662,"githubUrl":"https://github.com/cjpais/Handy/blob/98a4d80cce8ad41efec2a419b59d9e81229a35d7/src-tauri/src/managers/transcription.rs#L626-L662","documentation":"Thrown when StreamingModel::load fails to create the streaming Moonshine engine from the model files at model_path. Streaming Moonshine needs its own streaming ONNX artifacts; if they are absent, corrupt, or incompatible with the bundled ort, session creation errors and Handy aborts the load. As with the other engines, emit_loading_failed broadcasts a loading_failed model-state-changed event and the error is returned from load_model with the model_id and cause attached.","triggerScenarios":"load_model() hits EngineType::MoonshineStreaming and StreamingModel::load(&model_path, 0, &Quantization::default()) errors: the downloaded model pack is missing the streaming variant files, files are truncated from an interrupted download, or ort cannot allocate/create the session (missing execution provider, low memory).","commonSituations":"Partial download of the moonshine streaming model pack; disk-full during fetch; AV quarantine of .onnx files; version skew between cached model artifacts and a newly bundled transcribe-rs/ort after an app update; low-memory machines where Int8/default quantization still exceeds available RAM.","solutions":["Delete and re-download the moonshine streaming model via the model selector so ModelManager replaces the artifacts","Confirm the model directory contains the streaming ONNX files and they are non-zero length","Check disk space and security-software quarantine before re-downloading","Try the non-streaming Moonshine or a Whisper model to isolate whether only the streaming artifacts are broken","Update Handy so runtime and downloaded artifacts stay version-matched"],"exampleFix":"// before\nlet engine = StreamingModel::load(&model_path, 0, &Quantization::default());\n\n// after — surface an actionable failure and schedule a clean re-download\nlet engine = match StreamingModel::load(&model_path, 0, &Quantization::default()) {\n    Ok(engine) => engine,\n    Err(e) => {\n        emit_loading_failed(&format!(\"Failed to load moonshine streaming model {}: {}\", model_id, e));\n        self.model_manager.remove_local_model(model_id)?; // force fresh download next attempt\n        return Err(anyhow::anyhow!(\"moonshine streaming model corrupt, re-download scheduled: {}\", e));\n    }\n};","handlingStrategy":"validation","validationCode":"// Confirm the streaming model pack has its ONNX files before loading\nlet path = model_manager.get_model_path(model_id)?;\nlet onnx: Vec<_> = std::fs::read_dir(&path)?\n    .filter_map(|e| e.ok())\n    .filter(|e| e.path().extension().map_or(false, |x| x == \"onnx\"))\n    .collect();\nanyhow::ensure!(!onnx.is_empty() && onnx.iter().all(|e| e.metadata().map(|m| m.len() > 0).unwrap_or(false)),\n    \"streaming model artifacts incomplete under {} — re-download\", path.display());","typeGuard":null,"tryCatchPattern":"match tm.load_model(&model_id) {\n    Err(e) if e.to_string().contains(\"Failed to load moonshine streaming model\") => {\n        model_manager.remove_local_model(&model_id)?; // clear bad artifacts\n        tm.load_model(&model_id)? // retry once with a fresh download\n    }\n    other => other?,\n}","preventionTips":["Do not interrupt the first streaming-model download; a restart of the download is safer than resuming a partial pack","Keep the models directory out of sync/cleanup tools that may truncate files","After app updates, remove and re-fetch streaming models when loads start failing","Prefer non-streaming Moonshine or Whisper as a fallback engine in scripts that must not fail"],"tags":["rust","tauri","onnx","model-loading","moonshine","streaming","transcribe-rs"],"backgroundTag":"onnx-model-load-failed","analyzedSha":"98a4d80cce8ad41efec2a419b59d9e81229a35d7","analyzedAt":"2026-08-16T20:58:09.966Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}