NousResearch/hermes-agent · error · RuntimeError

Voice mode requires either Termux:API microphone access or P

Error message

Voice mode requires either Termux:API microphone access or Python audio libraries.
Option 1: pkg install termux-api and install the Termux:API Android app
Option 2: pkg install python-numpy portaudio && python -m pip install sounddevice

What it means

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.

Source

Thrown at cli.py:12895

    # ====================================================================

    def _voice_start_recording(self):
        """Start capturing audio from the microphone."""
        if getattr(self, '_should_exit', False):
            return
        from tools.voice_mode import create_audio_recorder, check_voice_requirements

        reqs = check_voice_requirements()
        if not reqs["audio_available"]:
            if _is_termux_environment():
                details = reqs.get("details", "")
                if "Termux:API Android app is not installed" in details:
                    raise RuntimeError(
                        "Termux:API command package detected, but the Android app is missing.\n"
                        "Install/update the Termux:API Android app, then retry /voice on.\n"
                        "Fallback: pkg install python-numpy portaudio && python -m pip install sounddevice"
                    )
                raise RuntimeError(
                    "Voice mode requires either Termux:API microphone access or Python audio libraries.\n"
                    "Option 1: pkg install termux-api and install the Termux:API Android app\n"
                    "Option 2: pkg install python-numpy portaudio && python -m pip install sounddevice"
                )
            raise RuntimeError(
                "Voice mode requires sounddevice and numpy.\n"
                f"Install with: {sys.executable} -m pip install sounddevice numpy"
            )
        if not reqs.get("stt_available", reqs.get("stt_key_set")):
            raise RuntimeError(
                "Voice mode requires an STT provider for transcription.\n"
                "Option 1: uv pip install faster-whisper  "
                "(free, local; `pip install faster-whisper` also works if pip is on PATH)\n"
                "Option 2: Set GROQ_API_KEY (free tier)\n"
                "Option 3: Set VOICE_TOOLS_OPENAI_KEY (paid)"
            )

        # Prevent double-start from concurrent threads (atomic check-and-set)

View on GitHub (pinned to c896c09c42)

Solutions

  1. Preferred: `pkg install termux-api` plus install the Termux:API Android app
  2. Alternative: `pkg install python-numpy portaudio && python -m pip install sounddevice`
  3. Re-run `/voice on` and verify check_voice_requirements()['audio_available'] is now true

Example fix

# before (in Termux)
/voice on  # RuntimeError: Voice mode requires either Termux:API microphone access or Python audio libraries.

# after
pkg install termux-api   # + install Termux:API app from F-Droid
/voice on
Defensive patterns

Strategy: try-catch

Validate before calling

from tools.voice_mode import check_voice_requirements

def voice_audio_ok() -> bool:
    return check_voice_requirements()["audio_available"]

Try / catch

try:
    cli._voice_start_recording()
except RuntimeError as e:
    if str(e).startswith("Voice mode requires either Termux:API"):
        print("Run: pkg install termux-api (plus the Android app), or pip install sounddevice numpy")
    else:
        raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of NousResearch/hermes-agent@c896c09c42 (2026-08-14). Data as JSON: /api/errors/5d7ba2aba1851408. Report an issue: GitHub.