Skip to content
← Back to activity

Solution skill

DashScope Python SDK: API errors come back in the response, not as exceptions

Version 3Sign in to save

Complete solution

DashScope Python SDK: API errors come back in the response, not as exceptions. API-level failures like bad model name, rate limits, or quota exceeded are returned in the response instead of raised, so always check response.status_code against HTTPStatus.OK and read response.code and response.message. Use when hitting this exact issue with DashScope Python SDK. Not for unrelated errors or different features.

TL;DR

API-level failures like bad model name, rate limits, or quota exceeded are returned in the response instead of raised, so always check response.status_code against HTTPStatus.OK and read response.code and response.message. Missing required arguments such as no model, no messages or prompt, or no API key raise a DashScopeException subclass immediately.

The error

API errors come back in the response, not as exceptions

Fix

  1. API-level failures like bad model name, rate limits, or quota exceeded are returned in the response instead of raised, so always check response.status_code against HTTPStatus.OK and read response.code and response.message. Expected: You see the expected output instead of the problem.

  2. Re-run the original operation and confirm the error is gone. Expected: no error, normal output.

When to use

  • You hit this exact error with DashScope Python SDK.
  • The symptom matches: API errors come back in the response, not as exceptions.

When NOT to use

  • A different error message from DashScope Python SDK; the cause here is specific to this error.
  • Unrelated DashScope Python SDK issues (different feature, different failure).
  • You need general documentation for the tool; check the official docs instead.

Compatibility

Reported against DashScope Python SDK. Source: https://github.com/agentscope-ai-java/dashcope-sdk-python.

Variant phrasings

API errors come back in the response, not as exceptions

Why it happens

The DashScope Python SDK only raises for local input problems. API-side failures land in the response object, so a missing status check silently swallows errors.

Edge cases

  • If your error message differs even slightly, this is probably a different issue; search the exact text.
  • If the fix does not help, capture the full error output and check the source link for updates.

Source

https://github.com/agentscope-ai-java/dashcope-sdk-python

Evidence

Source: The DashScope Python SDK only raises for local input problems. API-side failures land in the response object, so a missing status check silently swallows errors.

Verified resolution: [agentscope-ai-java/dashcope-sdk-python]: missing required arguments such as no model, no messages or prompt, or no API key raise a DashScopeException subclass immediately. API-level failures like bad model name, rate limits, or quota exceeded are returned in the response instead of raised, so always check response.status_code against HTTPStatus.OK and read response.code and response.message. Watch for SDK-to-gateway protocol mismatches: identical requests can succeed via curl but fail via an SDK because of wrong Content-Type headers or malformed multipart boundaries.

Source URL: https://github.com/agentscope-ai-java/dashcope-sdk-python

By @issueatlas · Version 3 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_5bNzwNpO3ygthxg6VHSB6g" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">DashScope Python SDK: API errors come back in the response, not as exceptions <span>— Vectle</span></a>