NousResearch/hermes-agent · error · RuntimeError

Termux:API command package detected, but the Android app is

Error message

Termux:API command package detected, but the Android app is missing.
Install/update the Termux:API Android app, then retry /voice on.
Fallback: pkg install python-numpy portaudio && python -m pip install sounddevice

What it means

Raised when starting voice recording on Termux: check_voice_requirements() reports audio unavailable, the failure details mention the Termux:API Android app being missing, and the Termux:API command package IS installed. The Termux CLI tools exist but the companion Android app that actually grants microphone access does not, so mic capture cannot proceed.

Source

Thrown at cli.py:12890

        except Exception:
            logger.debug("Edit diff preview failed for %s", function_name, exc_info=True)

    # ====================================================================
    # Voice mode methods
    # ====================================================================

    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"

View on GitHub (pinned to c896c09c42)

Solutions

  1. Install or update the 'Termux:API' Android app (F-Droid recommended, must match the Termux source)
  2. Re-run `/voice on` after granting the app microphone permission
  3. If the app cannot be fixed, fall back to Python audio: `pkg install python-numpy portaudio && python -m pip install sounddevice`

Example fix

# before (in Termux)
pkg install termux-api
/voice on  # RuntimeError: Termux:API command package detected, but the Android app is missing.

# after
# install 'Termux:API' app from F-Droid, grant mic permission, then
/voice on
Defensive patterns

Strategy: try-catch

Validate before calling

from tools.voice_mode import check_voice_requirements

def termux_api_ready() -> bool:
    reqs = check_voice_requirements()
    return reqs["audio_available"] or "Termux:API" not in reqs.get("details", "")

Try / catch

try:
    cli._voice_start_recording()
except RuntimeError as e:
    if "Termux:API Android app is missing" in str(e):
        prompt_user("Install the Termux:API app from F-Droid, then retry /voice on")
    else:
        raise

Prevention

When it happens

Trigger: Running `/voice on` inside Termux after `pkg install termux-api` but without installing (or after breaking/updating away) the 'Termux:API' app from F-Droid/Play, or when the app is installed but Termux cannot bind to it.

Common situations: Installing the termux-api package but skipping the Android app; Play Store variant of Termux lacking permission to call the API app; app updated/disabled so `termux-microphone-record` fails.

Related errors


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