harry0703/MoneyPrinterTurbo · warning · ValueError
Unsupported MiniMax voice type: {voice_type}
Error message
Unsupported MiniMax voice type: {voice_type} What it means
Input validation in the MiniMax voice-catalog query: voice_type must be one of 'system', 'voice_cloning', 'voice_generation', or 'all'. Any other string raises ValueError immediately, before any API key or network work is done.
Source
Thrown at app/services/voice.py:1385
if inferred_url:
return inferred_url
return _resolve_minimax_tts_url(config.minimax_tts.get("base_url", ""))
def get_minimax_voice_catalog(
api_key: str = "",
endpoint: str = "",
voice_type: str = "all",
) -> list[dict[str, str]]:
"""
查询当前 MiniMax 账号可用的系统、克隆和生成音色。
返回值统一为 voice_id、voice_name、voice_type 三个字段,调用方无需了解
MiniMax 按音色来源拆分数组的响应结构。查询失败时抛出异常,让 WebUI、
API 或 CLI 可以按各自交互方式展示明确错误,而不是静默返回空列表。
"""
if voice_type not in {"system", "voice_cloning", "voice_generation", "all"}:
raise ValueError(f"Unsupported MiniMax voice type: {voice_type}")
effective_api_key = str(api_key or get_minimax_tts_api_key()).strip()
if not effective_api_key:
raise ValueError("MiniMax TTS API key is not set")
tts_endpoint = (
_resolve_minimax_tts_url(endpoint)
if endpoint
else get_minimax_tts_endpoint()
)
voice_endpoint = (
f"{tts_endpoint[:-len('/t2a_v2')]}/get_voice"
if tts_endpoint.endswith("/t2a_v2")
else f"{tts_endpoint.rstrip('/')}/get_voice"
)
response = requests.post(
voice_endpoint,
json={"voice_type": voice_type},View on GitHub (pinned to 1f9f19c202)
Solutions
- Use one of the exact allowed values: 'system', 'voice_cloning', 'voice_generation', 'all' (lowercase).
- Validate/lowercase the input before calling, surfacing the allowed set to the user in the UI.
Example fix
# before
voices = list_minimax_voices(voice_type="cloned")
# after
_ALLOWED = {"system", "voice_cloning", "voice_generation", "all"}
voice_type = voice_type if voice_type in _ALLOWED else "all"
voices = list_minimax_voices(voice_type=voice_type) Defensive patterns
Strategy: validation
Validate before calling
ALLOWED_MINIMAX_VOICE_TYPES = {"system", "voice_cloning", "voice_generation", "all"}
if voice_type not in ALLOWED_MINIMAX_VOICE_TYPES:
voice_type = "all" # or raise with the allowed set in the message Type guard
def is_valid_minimax_voice_type(value: str) -> bool:
return isinstance(value, str) and value in {
"system", "voice_cloning", "voice_generation", "all"
} Prevention
- Derive UI dropdown options from the allowed set so users cannot submit invalid values.
- Lowercase and trim user input before passing it through.
When it happens
Trigger: Calling the MiniMax get-voice listing function with a typo'd or unsupported voice_type such as 'System', 'cloned', 'voice-clone', or 'default'.
Common situations: Caller passes an unvalidated user-supplied filter straight from a WebUI dropdown or CLI flag; casing mismatch ('System' vs 'system'); value copied from MiniMax docs that uses a different naming scheme.
Related errors
- invalid voice name: {voice_name}
- MiniMax TTS API key is not set
- MiniMax get_voice failed with status {response.status_code}:
- MiniMax get_voice failed: {status_message}
- MiniMax TTS returned audio with an invalid duration
AI-assisted analysis of harry0703/MoneyPrinterTurbo@1f9f19c202 (2026-08-14).
Data as JSON: /api/errors/85e9ccb224c018c6.
Report an issue: GitHub.