harry0703/MoneyPrinterTurbo · error · SoniloError

Sonilo video-to-music service is not available for this key

Error message

Sonilo video-to-music service is not available for this key

What it means

Raised by the Sonilo connection test when the service list parsed successfully but does not contain the video-to-music service after normalization (ids are lowercased and dashes converted to underscores, so video-to-music and video_to_music both match). This means the account or key genuinely lacks access to the endpoint this integration depends on; it is not a parsing problem.

Source

Thrown at app/services/sonilo.py:119

            f"Sonilo connection failed ({response.status_code}): "
            f"{_safe_response_error(response)}"
        )
    try:
        payload = response.json()
    except ValueError as exc:
        raise SoniloError("Sonilo returned an invalid service response") from exc
    if not isinstance(payload, dict):
        raise SoniloError("Sonilo returned an unexpected service response")
    available_services = payload.get("available_services")
    if not isinstance(available_services, list) or not all(
        isinstance(service_id, str) for service_id in available_services
    ):
        raise SoniloError("Sonilo returned an invalid service list")
    normalized_services = {
        _normalize_service_id(service_id) for service_id in available_services
    }
    if VIDEO_TO_MUSIC_SERVICE_ID not in normalized_services:
        raise SoniloError("Sonilo video-to-music service is not available for this key")
    logger.info("Sonilo connection test succeeded")
    return payload


def _remove_file(file_path: str) -> None:
    """尽力清理 Sonilo 中间文件,不覆盖调用方正在处理的原始异常。"""
    if not file_path or not os.path.exists(file_path):
        return
    try:
        os.remove(file_path)
    except OSError as exc:
        logger.warning(
            f"failed to remove Sonilo temporary file: path={file_path}, error={exc}"
        )


def _create_video_proxy(video_path: str) -> str:
    """

View on GitHub (pinned to 1f9f19c202)

Solutions

  1. Log in to the Sonilo dashboard and verify the key's plan includes video_to_music; upgrade or enable the service if missing.
  2. Confirm the key configured in the WebUI (config sonilo_api_key) or the SONILO_API_KEY environment variable is the one you think it is; re-run the test with a freshly copied key.
  3. Check for an environment mismatch (staging vs production base URL in sonilo_base_url) and point the test at the environment where the key is provisioned.
  4. If the dashboard shows the service active but the API disagrees, contact Sonilo support; the entitlement data is server-side.
Defensive patterns

Strategy: validation

Validate before calling

# before starting any video-to-music task, run the connection test
# it raises this exact error when the key lacks the entitlement
sonilo.test_connection()  # cheap; do it once at task submission

Try / catch

try:
    sonilo.test_connection()
except SoniloError as exc:
    if "not available for this key" in str(exc):
        # entitlement problem: retrying with the same key cannot help
        disable_sonilo_and_fallback(exc)
    raise

Prevention

When it happens

Trigger: Calling the connection test with an API key whose Sonilo plan does not include video-to-music: available_services comes back listing only other services such as text_to_speech or voice_clone. Also occurs with a key from a different environment (staging key against production) or a key whose subscription lapsed so the services endpoint reflects the downgraded plan.

Common situations: Free-tier or trial key that never had video-to-music entitlements; subscription expired mid-cycle; using the wrong key after rotating credentials; provider temporarily disables the service for the account.

Related errors


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