{"record":{"id":"97d76d57c67373fe","repo":"tonhowtf/omniget","slug":"nada-foi-gravado-microfone-permissao","errorCode":null,"errorMessage":"nada foi gravado (microfone/permissao?) {}","messagePattern":"nada foi gravado \\(microfone/permissao\\?\\) (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/dictation.rs","lineNumber":292,"sourceCode":"        }\n        // 'q' no stdin encerra o ffmpeg fechando o WAV corretamente.\n        if let Some(mut stdin) = rec.child.stdin.take() {\n            use tokio::io::AsyncWriteExt;\n            let _ = stdin.write_all(b\"q\\n\").await;\n            let _ = stdin.flush().await;\n        }\n        let status =\n            tokio::time::timeout(std::time::Duration::from_secs(8), rec.child.wait()).await;\n        if status.is_err() {\n            let _ = rec.child.kill().await;\n        }\n        if !rec.wav.exists() || std::fs::metadata(&rec.wav).map(|m| m.len()).unwrap_or(0) < 1000 {\n            let mut err = String::new();\n            if let Some(mut e) = rec.child.stderr.take() {\n                use tokio::io::AsyncReadExt;\n                let _ = e.read_to_string(&mut err).await;\n            }\n            return Err(anyhow!(\n                \"nada foi gravado (microfone/permissao?) {}\",\n                err.trim()\n            ));\n        }\n        let opts = options();\n        let out_dir = super::temp_dir().join(\"dictation-out\");\n        let _ = std::fs::create_dir_all(&out_dir);\n        let t = super::whisper::transcribe(\n            super::whisper::TranscribeOptions {\n                input: rec.wav.to_string_lossy().to_string(),\n                model: opts.model.clone(),\n                language: opts.language.clone(),\n                translate: false,\n                max_len: 0,\n                prompt: String::new(),\n                output_dir: out_dir.to_string_lossy().to_string(),\n                threads: 0,\n            },","sourceCodeStart":274,"sourceCodeEnd":310,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/dictation.rs#L274-L310","documentation":"After stopping ffmpeg, stop() validates the WAV output: if the file is missing or smaller than 1000 bytes, nothing usable was captured. ffmpeg's captured stderr is appended to the message to explain why ('nothing was recorded — microphone/permission?').","triggerScenarios":"rec.wav does not exist or its length < 1000 bytes when checked right after the ffmpeg child finishes.","commonSituations":"Microphone not plugged in or wrong input device configured; OS privacy settings deny microphone access to the app (macOS TCC, Windows privacy); selected input device name no longer matches after hardware change; ffmpeg exited immediately due to an invalid device string.","solutions":["Grant microphone permission to the app in OS privacy settings (macOS: System Settings > Privacy & Security > Microphone; Windows: Settings > Privacy > Microphone).","Check the configured audio input device in the app's dictation options and select a valid, connected device.","Read the appended ffmpeg stderr in the error message — it names the real capture failure (e.g. 'Device or resource busy').","Verify the microphone works in another app; close other apps holding exclusive access to the device."],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":"// Rust: verify a default input device is reachable before recording\ndef assert_mic_available() -> Result<(), String> {\n    // enumerate input devices; error if none or permission pending\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":"match dictation::stop(progress).await {\n    Err(e) if e.to_string().contains(\"nada foi gravado\") => {\n        eprintln!(\"mic issue: {e}\"); // includes ffmpeg stderr — check device/permissions\n    }\n    other => other?,\n}","preventionTips":["Request microphone permission at app startup, not at first use.","Validate the configured input device exists before each recording.","Surface the appended ffmpeg stderr to the user for diagnosis.","Test mic availability (device probe) before entering push-to-talk mode."],"tags":["dictation","microphone","permission-denied","ffmpeg","audio"],"backgroundTag":"permission-denied","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}