{"record":{"id":"5d7ba2aba1851408","repo":"NousResearch/hermes-agent","slug":"voice-mode-requires-either-termux-api-microphone-a","errorCode":null,"errorMessage":"Voice mode requires either Termux:API microphone access or Python audio libraries.\nOption 1: pkg install termux-api and install the Termux:API Android app\nOption 2: pkg install python-numpy portaudio && python -m pip install sounddevice","messagePattern":"Voice mode requires either Termux:API microphone access or Python audio libraries\\.\nOption 1: pkg install termux-api and install the Termux:API Android app\nOption 2: pkg install python-numpy portaudio && python -m pip install sounddevice","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"cli.py","lineNumber":12895,"sourceCode":"    # ====================================================================\n\n    def _voice_start_recording(self):\n        \"\"\"Start capturing audio from the microphone.\"\"\"\n        if getattr(self, '_should_exit', False):\n            return\n        from tools.voice_mode import create_audio_recorder, check_voice_requirements\n\n        reqs = check_voice_requirements()\n        if not reqs[\"audio_available\"]:\n            if _is_termux_environment():\n                details = reqs.get(\"details\", \"\")\n                if \"Termux:API Android app is not installed\" in details:\n                    raise RuntimeError(\n                        \"Termux:API command package detected, but the Android app is missing.\\n\"\n                        \"Install/update the Termux:API Android app, then retry /voice on.\\n\"\n                        \"Fallback: pkg install python-numpy portaudio && python -m pip install sounddevice\"\n                    )\n                raise RuntimeError(\n                    \"Voice mode requires either Termux:API microphone access or Python audio libraries.\\n\"\n                    \"Option 1: pkg install termux-api and install the Termux:API Android app\\n\"\n                    \"Option 2: pkg install python-numpy portaudio && python -m pip install sounddevice\"\n                )\n            raise RuntimeError(\n                \"Voice mode requires sounddevice and numpy.\\n\"\n                f\"Install with: {sys.executable} -m pip install sounddevice numpy\"\n            )\n        if not reqs.get(\"stt_available\", reqs.get(\"stt_key_set\")):\n            raise RuntimeError(\n                \"Voice mode requires an STT provider for transcription.\\n\"\n                \"Option 1: uv pip install faster-whisper  \"\n                \"(free, local; `pip install faster-whisper` also works if pip is on PATH)\\n\"\n                \"Option 2: Set GROQ_API_KEY (free tier)\\n\"\n                \"Option 3: Set VOICE_TOOLS_OPENAI_KEY (paid)\"\n            )\n\n        # Prevent double-start from concurrent threads (atomic check-and-set)","sourceCodeStart":12877,"sourceCodeEnd":12913,"githubUrl":"https://github.com/NousResearch/hermes-agent/blob/c896c09c42910c584c4c7d2325b58c14713ea42c/cli.py#L12877-L12913","documentation":"Raised when voice recording starts in a Termux environment, audio is unavailable, and the failure is NOT the specific 'Android app missing' case (that gets error 462). It means neither Termux:API microphone access nor the Python audio stack (sounddevice/numpy) works, and the message lists both remediation paths.","triggerScenarios":"Running `/voice on` in Termux when termux-api is not installed AND sounddevice/numpy are not importable — e.g. a fresh Termux install, or a Python venv that lacks portaudio so sounddevice import fails while the termux-api package is absent.","commonSituations":"Fresh Termux setup; a venv built without libportaudio; termux-api package removed; running under a non-Termux terminal app that nonetheless trips _is_termux_environment.","solutions":["Preferred: `pkg install termux-api` plus install the Termux:API Android app","Alternative: `pkg install python-numpy portaudio && python -m pip install sounddevice`","Re-run `/voice on` and verify check_voice_requirements()['audio_available'] is now true"],"exampleFix":"# before (in Termux)\n/voice on  # RuntimeError: Voice mode requires either Termux:API microphone access or Python audio libraries.\n\n# after\npkg install termux-api   # + install Termux:API app from F-Droid\n/voice on","handlingStrategy":"try-catch","validationCode":"from tools.voice_mode import check_voice_requirements\n\ndef voice_audio_ok() -> bool:\n    return check_voice_requirements()[\"audio_available\"]","typeGuard":null,"tryCatchPattern":"try:\n    cli._voice_start_recording()\nexcept RuntimeError as e:\n    if str(e).startswith(\"Voice mode requires either Termux:API\"):\n        print(\"Run: pkg install termux-api (plus the Android app), or pip install sounddevice numpy\")\n    else:\n        raise","preventionTips":["On Termux, set up one of the two audio paths before enabling voice mode","Verify `python -c 'import sounddevice'` works in the Termux Python you use","Gate the /voice UI on check_voice_requirements() so users see readiness first"],"tags":["voice","termux","audio","dependencies"],"backgroundTag":null,"analyzedSha":"c896c09c42910c584c4c7d2325b58c14713ea42c","analyzedAt":"2026-08-14T17:18:01.089Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}