harry0703/MoneyPrinterTurbo · error · ElevenLabsMusicError

ElevenLabs subscription response does not include an account

Error message

ElevenLabs subscription response does not include an account tier

What it means

ElevenLabsMusicError raised by test_connection() when the subscription dict parsed successfully but payload['tier'] is missing, empty, or whitespace-only after str().strip().lower(). The tier field is what distinguishes free accounts (rejected separately) from paid ones, so a response without it cannot be validated. This indicates an unexpected API shape — normally only seen with custom base URLs, mocks, or undocumented upstream changes.

Source

Thrown at app/services/elevenlabs_music.py:149

                    f"{_safe_response_error(response)}"
                )
            try:
                payload = response.json()
            except ValueError as exc:
                raise ElevenLabsMusicError(
                    "ElevenLabs returned an invalid subscription response"
                ) from exc
    except requests.RequestException as exc:
        raise ElevenLabsMusicError(
            f"failed to connect to ElevenLabs: {exc}"
        ) from exc
    if not isinstance(payload, dict):
        raise ElevenLabsMusicError(
            "ElevenLabs returned an unexpected subscription response"
        )
    tier = str(payload.get("tier") or "").strip().lower()
    if not tier:
        raise ElevenLabsMusicError(
            "ElevenLabs subscription response does not include an account tier"
        )
    if tier == "free":
        raise ElevenLabsPaidPlanRequiredError(
            "ElevenLabs Music API requires a paid plan; "
            "the current account is on the free tier"
        )
    logger.info(f"ElevenLabs account and plan check succeeded: tier={tier}")
    return payload


def validate_generation_access() -> None:
    """
    在昂贵的视频流水线开始前排除确定无法生成配乐的账号。

    免费套餐和无效 Key 都是确定性错误,必须立即终止,避免先消耗 LLM、TTS
    和素材服务额度。订阅接口也可能因 Music-only endpoint scope、IP 限制或
    临时网络问题不可访问;这些结果不能证明 Music API 不可用,因此只记录警告,

View on GitHub (pinned to 1f9f19c202)

Solutions

  1. curl the subscription endpoint with the real key and inspect the JSON — confirm 'tier' is present in the raw response.
  2. Fix the mock/gateway to pass the upstream body through unchanged.
  3. If the upstream schema genuinely changed, update the parsing in elevenlabs_music.py to match the new field.
Defensive patterns

Strategy: try-catch

Try / catch

try:
    test_connection()
except ElevenLabsMusicError as e:
    if 'does not include an account tier' in str(e):
        warn('Unexpected API shape; check music_base_url or upstream API changes')
        raise

Prevention

When it happens

Trigger: Subscription endpoint returns 200 with a valid JSON dict lacking 'tier' (e.g. an error-shaped object like {"detail": {...}} with 200 status, or a partial mock).

Common situations: Mock/stub servers returning minimal objects; gateways that wrap responses ({"data": {...}}); ElevenLabs changing field names after an API revision.

Related errors


AI-assisted analysis of harry0703/MoneyPrinterTurbo@1f9f19c202 (2026-08-14). Data as JSON: /api/errors/774da2f8c312585b. Report an issue: GitHub.