invoke-ai/InvokeAI · error · ExternalProviderRequestError

Unknown DashScope model_id '{model_id}'. Add it to _SYNC_MOD

Error message

Unknown DashScope model_id '{model_id}'. Add it to _SYNC_MODELS or _ASYNC_MODELS in alibabacloud.py.

What it means

DashScope splits models into synchronous and asynchronous task-based APIs. The provider dispatches based on membership in the hardcoded module-level lists _SYNC_MODELS and _ASYNC_MODELS; a model_id not in either list has no implemented call path, so generate() raises ExternalProviderRequestError telling the developer to extend the provider code.

Source

Thrown at invokeai/app/services/external_generation/providers/alibabacloud.py:67

        api_key = self._app_config.external_alibabacloud_api_key
        if not api_key:
            raise ExternalProviderRequestError("Alibaba Cloud DashScope API key is not configured")

        base_url = (self._app_config.external_alibabacloud_base_url or "https://dashscope-intl.aliyuncs.com").rstrip(
            "/"
        )
        model_id = request.model.provider_model_id
        headers = {
            "Content-Type": "application/json",
            "Authorization": f"Bearer {api_key}",
        }
        size = f"{request.width}*{request.height}"

        if model_id in _SYNC_MODELS:
            return self._generate_sync(request, base_url, headers, model_id, size)
        if model_id in _ASYNC_MODELS:
            return self._generate_async(request, base_url, headers, model_id, size)
        raise ExternalProviderRequestError(
            f"Unknown DashScope model_id '{model_id}'. Add it to _SYNC_MODELS or _ASYNC_MODELS in alibabacloud.py."
        )

    def _generate_sync(
        self,
        request: ExternalGenerationRequest,
        base_url: str,
        headers: dict[str, str],
        model_id: str,
        size: str,
    ) -> ExternalGenerationResult:
        """Use the synchronous multimodal-generation endpoint (messages format)."""
        endpoint = f"{base_url}/api/v1/services/aigc/multimodal-generation/generation"

        content: list[dict[str, str]] = []

        # Reference images: DashScope multimodal accepts up to 3 input images for the
        # qwen-image-edit family; we let the API surface its own limit if exceeded.

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Check the model id spelling against DashScope's documented model ids and correct it in provider settings
  2. Upgrade InvokeAI to a version whose _SYNC_MODELS/_ASYNC_MODELS includes the desired model
  3. Add the model id to the appropriate list (_SYNC_MODELS for sync APIs, _ASYNC_MODELS for task-based APIs) in alibabacloud.py and implement/reuse the matching call path
  4. Choose a model already registered in the installed version

Example fix

# before (alibabacloud.py)
_SYNC_MODELS = {"wanx2.1-t2i-turbo"}
# after
_SYNC_MODELS = {"wanx2.1-t2i-turbo", "wan2.5-t2i"}  # newly registered model id
Defensive patterns

Strategy: validation

Validate before calling

from invokeai.app.services.external_generation.providers.alibabacloud import _SYNC_MODELS, _ASYNC_MODELS
if request.model.provider_model_id not in _SYNC_MODELS | _ASYNC_MODELS:
    raise ValueError(f"DashScope model {request.model.provider_model_id!r} not registered in alibabacloud.py")

Type guard

def is_registered_model(model_id: str) -> bool:
    return model_id in _SYNC_MODELS or model_id in _ASYNC_MODELS

Try / catch

try:
    result = provider.generate(request)
except ExternalProviderRequestError as e:
    if 'Unknown DashScope model_id' in str(e):
        raise UnsupportedModelError(request.model.provider_model_id) from e
    raise

Prevention

When it happens

Trigger: request.model.provider_model_id is a DashScope model id (or typo/renamed id) not present in _SYNC_MODELS or _ASYNC_MODELS in alibabacloud.py at the time of the call.

Common situations: Alibaba released a new image model after this InvokeAI version was cut; admin entered a custom model id in provider settings; a typo or changed model id (e.g. renamed wanx variant); using an outdated InvokeAI version lacking newer model registrations.

Related errors


AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29). Data as JSON: /api/errors/0e7d1a5f825a2616. Report an issue: GitHub.