{"record":{"id":"0fb81f12bd95e4ca","repo":"tonhowtf/omniget","slug":"amostra","errorCode":null,"errorMessage":"amostra: {}","messagePattern":"amostra: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/voicestudio.rs","lineNumber":284,"sourceCode":"    progress: super::ProgressFn,\n) -> anyhow::Result<SpeechResult> {\n    let b = base(&opts.base_url);\n    let c = client(900)?;\n    let mut profile_id = if opts.profile_id.trim().is_empty() {\n        None\n    } else {\n        Some(opts.profile_id.trim().to_string())\n    };\n    if profile_id.is_none() && !opts.save_as.trim().is_empty() {\n        super::report(\n            &progress,\n            \"voicestudio\",\n            \"profile\",\n            0,\n            None,\n            Some(opts.save_as.clone()),\n        );\n        let sample = std::fs::read(&opts.sample).map_err(|e| anyhow!(\"amostra: {}\", e))?;\n        let file_name = Path::new(&opts.sample)\n            .file_name()\n            .map(|s| s.to_string_lossy().to_string())\n            .unwrap_or_else(|| \"sample.wav\".into());\n        let form = reqwest::multipart::Form::new()\n            .text(\"name\", opts.save_as.trim().to_string())\n            .text(\"kind\", \"clone\")\n            .text(\"ref_text\", opts.sample_text.clone())\n            .text(\n                \"language\",\n                if opts.language.is_empty() {\n                    \"Auto\".to_string()\n                } else {\n                    opts.language.clone()\n                },\n            )\n            .part(\n                \"ref_audio\",","sourceCodeStart":266,"sourceCodeEnd":302,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/voicestudio.rs#L266-L302","documentation":"clone_speak reads the local voice sample file with std::fs::read before building the multipart profile-creation form, and wraps any I/O failure as 'amostra: {}' (sample: {}), including the OS error. It means the sample audio file could not be read from disk.","triggerScenarios":"opts.sample points to a path that does not exist, is a directory, or the process lacks read permission when creating a cloned voice profile.","commonSituations":"User typed a wrong path in the UI, the sample was recorded to a temp dir that was cleaned up, or the file is on an unmounted network drive.","solutions":["Check the error's inner OS message: NotFound means fix the path; PermissionDenied means fix file permissions.","Verify opts.sample exists and is a regular file before calling clone_speak (std::path::Path::is_file).","Correct the sample path passed by the caller/UI.","Ensure the sample file was fully written (not still being recorded) before invoking clone_speak."],"exampleFix":"// before\nlet sample = std::fs::read(&opts.sample).map_err(|e| anyhow!(\"amostra: {}\", e))?;\n// after\nlet sample_path = Path::new(&opts.sample);\nif !sample_path.is_file() {\n    anyhow::bail!(\"amostra: arquivo nao encontrado: {}\", opts.sample);\n}\nlet sample = std::fs::read(sample_path).map_err(|e| anyhow!(\"amostra: {}\", e))?;","handlingStrategy":"validation","validationCode":"fn validate_sample(path: &str) -> Result<(), String> {\n    let p = std::path::Path::new(path);\n    if !p.is_file() { return Err(format!(\"sample not a file: {path}\")); }\n    match std::fs::metadata(p) {\n        Ok(m) if m.len() > 0 => Ok(()),\n        Ok(_) => Err(\"sample file is empty\".into()),\n        Err(e) => Err(format!(\"sample unreadable: {e}\")),\n    }\n}","typeGuard":null,"tryCatchPattern":"match std::fs::read(&opts.sample) {\n    Ok(bytes) => { /* build multipart form */ }\n    Err(e) if e.kind() == std::io::ErrorKind::NotFound => eprintln!(\"amostra nao encontrada: {}\", opts.sample),\n    Err(e) if e.kind() == std::io::ErrorKind::PermissionDenied => eprintln!(\"sem permissao: {}\", opts.sample),\n    Err(e) => eprintln!(\"amostra: {e}\"),\n}","preventionTips":["Always validate the sample path with Path::is_file before voice-clone calls.","Copy samples to a stable app-owned directory instead of relying on temp files.","Surface file-picker results immediately; do not store raw paths across long sessions.","Check file readability permissions after recording or importing a sample."],"tags":["file-io","file-not-found","rust","audio"],"backgroundTag":"file-read-failed","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}