harry0703/MoneyPrinterTurbo · error · Exception
[{llm_provider}] returned an error response: "{response}"
Error message
[{llm_provider}] returned an error response: "{response}" What it means
Raised in the qwen adapter branch of _generate_response() after dashscope.Generation.call() returns a GenerationResponse whose status_code is not 200. Dashscope does not raise on API errors; it packs the HTTP status and code/message into the response object, so this check is the only error surfacing. The full response object is embedded in the message for diagnosis.
Source
Thrown at app/services/llm.py:228
if field.required and not extra_values[field.config_suffix]:
raise ValueError(
f"{llm_provider}: {field.config_suffix} is not set, "
"please set it in the config.toml file."
)
if adapter == "qwen":
import dashscope
from dashscope.api_entities.dashscope_response import GenerationResponse
dashscope.api_key = api_key
response = dashscope.Generation.call(
model=model_name, messages=[{"role": "user", "content": prompt}]
)
if response:
if isinstance(response, GenerationResponse):
status_code = response.status_code
if status_code != 200:
raise Exception(
f'[{llm_provider}] returned an error response: "{response}"'
)
return _extract_qwen_generation_text(response)
else:
raise Exception(
f'[{llm_provider}] returned an invalid response: "{response}"'
)
else:
raise Exception(f"[{llm_provider}] returned an empty response")
if adapter == "gemini":
from google import genai
from google.genai import types
http_options = types.HttpOptions(base_url=base_url) if base_url else None
generation_config = types.GenerateContentConfig(
temperature=0.5,View on GitHub (pinned to 1f9f19c202)
Solutions
- Inspect the embedded response: response.code and response.message inside the f-string identify the exact DashScope error (InvalidApiKey, Throttling, InvalidParameter, etc.)
- For 401/403 fix [qwen].api_key in config.toml (or set it via WebUI) and re-run test_connection()
- For 429 throttle, slow down generation requests or upgrade the DashScope quota tier
- For invalid model errors, set [qwen].model_name to a currently valid model (e.g. qwen-turbo/qwen-plus) and upgrade the dashscope package
- For 5xx or intermittent SDK errors, retry — the caller already wraps this in a retry loop (_max_retries = 5) so repeated failures indicate a persistent issue
Example fix
# before
response = dashscope.Generation.call(
model=model_name, messages=[{"role": "user", "content": prompt}]
)
if status_code != 200:
raise Exception(f'[{llm_provider}] returned an error response: "{response}"')
# after (log the structured fields instead of the whole object)
if status_code != 200:
raise Exception(
f"[qwen] API error {status_code}: {response.code} - {response.message}"
) Defensive patterns
Strategy: retry
Try / catch
except Exception as e: — inspect the embedded DashScope code; retry only on 429/5xx-type codes (Throttling, ServiceUnavailable), fail fast on 401/403 (InvalidApiKey) since retries cannot fix credentials
Prevention
- Keep the qwen api_key valid and rotate before expiry
- Batch generation jobs with pacing to stay under DashScope QPS limits
- Log response.code/response.message separately so failures are triageable without the full response dump
When it happens
Trigger: dashscope.Generation.call(model=..., messages=[...]) returning status_code 400/401/403/429/500 — e.g. invalid DASHSCOPE API key (401 InvalidApiKey), rate limiting (429 Throttling), nonexistent model_name, or DashScope service outage; also SDK-level errors reported through the response envelope.
Common situations: Expired or mistyped qwen api_key in config.toml; using a model name not available to the account's region; hitting free-tier QPS limits during batch video generation; dashscope SDK version drift changing status_code semantics; mainland vs international DashScope endpoint mismatch.
Related errors
- [qwen] returned empty choices
- [{llm_provider}] returned an invalid response: "{response}"
- [{llm_provider}] returned an empty response
- [{llm_provider}] returned an empty response, please check yo
- failed to connect to ElevenLabs: {exc}
AI-assisted analysis of harry0703/MoneyPrinterTurbo@1f9f19c202 (2026-08-14).
Data as JSON: /api/errors/50f1327790043aa6.
Report an issue: GitHub.