HKUDS/DeepTutor · error · VoiceProviderError
Unsupported STT adapter: {name!r}
Error message
Unsupported STT adapter: {name!r} What it means
get_stt_adapter(name) resolves an STT adapter from the STT_ADAPTERS registry keyed by name, defaulting to "openai_compat" only when the name is empty/None. If the name is non-empty but not a registered key, a VoiceProviderError is raised. This guards against typos or uninstalled STT backends.
Source
Thrown at deeptutor/services/voice/adapters/__init__.py:38
"openrouter_tts": OpenRouterTTSAdapter(),
}
STT_ADAPTERS: dict[str, BaseSTTAdapter] = {
"openai_compat": OpenAICompatSTTAdapter(),
}
def get_tts_adapter(name: str) -> BaseTTSAdapter:
adapter = TTS_ADAPTERS.get(name or "openai_compat")
if adapter is None:
raise VoiceProviderError(f"Unsupported TTS adapter: {name!r}")
return adapter
def get_stt_adapter(name: str) -> BaseSTTAdapter:
adapter = STT_ADAPTERS.get(name or "openai_compat")
if adapter is None:
raise VoiceProviderError(f"Unsupported STT adapter: {name!r}")
return adapter
__all__ = [
"TTS_ADAPTERS",
"STT_ADAPTERS",
"get_tts_adapter",
"get_stt_adapter",
]
View on GitHub (pinned to 3e82f13042)
Solutions
- Check the exact keys of STT_ADAPTERS in deeptutor/services/voice/adapters/__init__.py and correct the configured name
- Set the STT adapter name to "openai_compat" (or leave it empty to use the default)
- If a custom adapter is expected, register it in STT_ADAPTERS or install the extra that provides it
Example fix
// before
adapter = get_stt_adapter("whisper_local")
// after
adapter = get_stt_adapter("openai_compat") Defensive patterns
Strategy: validation
Validate before calling
from deeptutor.services.voice.adapters import STT_ADAPTERS
name = (stt_name or "openai_compat").strip()
if name not in STT_ADAPTERS:
raise ValueError(f"Unknown STT adapter {name!r}; available: {sorted(STT_ADAPTERS)}")
adapter = get_stt_adapter(name) Type guard
def is_known_stt_adapter(name: str) -> bool:
return (name or "openai_compat") in STT_ADAPTERS Prevention
- Whitelist adapter names in UI/settings dropdowns from STT_ADAPTERS.keys()
- Validate the configured adapter name at settings-save time, not at call time
- Default empty names to openai_compat explicitly in your config layer
When it happens
Trigger: Calling get_stt_adapter("whisper") or any name not present in STT_ADAPTERS (e.g. a name copied from TTS config, or a backend whose extra deps were not installed). Empty string or None falls back to "openai_compat" and does NOT raise.
Common situations: A voice settings JSON names an STT provider that isn't compiled into this build (missing optional dependency), a copy-paste of the TTS adapter name into the STT field, or a renamed adapter after an upgrade.
Related errors
- {action} failed with HTTP {status_code}: {detail}
- No endpoint URL configured for STT.
- No audio data to transcribe.
- STT request error: {exc}
- Transcription response had no `text` field.
AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27).
Data as JSON: /api/errors/62b51b8812fd926a.
Report an issue: GitHub.