{"record":{"id":"e1ab5e1dfffe2904","repo":"invoke-ai/InvokeAI","slug":"mode-request-mode-is-not-supported-by-request","errorCode":null,"errorMessage":"Mode '{request.mode}' is not supported by {request.model.name}","messagePattern":"Mode '(.+?)' is not supported by (.+?)","errorType":"exception","errorClass":"ExternalProviderCapabilityError","httpStatus":null,"severity":"error","filePath":"invokeai/app/services/external_generation/external_generation_default.py","lineNumber":106,"sourceCode":"                time.sleep(delay)\n        raise ExternalProviderRateLimitError(\"Rate limit exceeded after all retries\")\n\n    def get_provider_statuses(self) -> dict[str, ExternalProviderStatus]:\n        return {provider_id: provider.get_status() for provider_id, provider in self._providers.items()}\n\n    def _validate_request(self, request: ExternalGenerationRequest) -> None:\n        capabilities = request.model.capabilities\n\n        self._logger.debug(\n            \"Validating external request provider=%s model=%s mode=%s supported=%s\",\n            request.model.provider_id,\n            request.model.provider_model_id,\n            request.mode,\n            capabilities.modes,\n        )\n\n        if request.mode not in capabilities.modes:\n            raise ExternalProviderCapabilityError(f\"Mode '{request.mode}' is not supported by {request.model.name}\")\n\n        if request.reference_images and not capabilities.supports_reference_images:\n            raise ExternalProviderCapabilityError(f\"Reference images are not supported by {request.model.name}\")\n\n        if capabilities.max_reference_images is not None:\n            if len(request.reference_images) > capabilities.max_reference_images:\n                raise ExternalProviderCapabilityError(\n                    f\"{request.model.name} supports at most {capabilities.max_reference_images} reference images\"\n                )\n\n        if capabilities.max_images_per_request is not None and request.num_images > capabilities.max_images_per_request:\n            raise ExternalProviderCapabilityError(\n                f\"{request.model.name} supports at most {capabilities.max_images_per_request} images per request\"\n            )\n\n        if capabilities.max_image_size is not None:\n            if request.width > capabilities.max_image_size.width or request.height > capabilities.max_image_size.height:\n                raise ExternalProviderCapabilityError(","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/services/external_generation/external_generation_default.py#L88-L124","documentation":"ExternalProviderCapabilityError raised by _validate_request when request.mode is not present in the model's capabilities.modes list. The requested generation mode (e.g. text2img, img2img, inpaint) is not offered by that external model.","triggerScenarios":"generate() called with a request whose mode (from ExternalGenerationRequest) fails the `request.mode not in capabilities.modes` check for the selected model.","commonSituations":"Selecting an inpaint mode against a pure text-to-image model; UI state retaining an old mode after the user switched models; model capability metadata outdated relative to what the provider actually offers.","solutions":["Use a mode listed in the model's capabilities.modes","Select a different model that supports the desired mode","Refresh model capabilities (_refresh_model_capabilities) so the model's mode list is current","Fix UI/workflow code that sends a stale mode with the request"],"exampleFix":"// before\nrequest.mode = \"inpaint\"  # model only supports text2img\n\n// after\nif \"inpaint\" in model.capabilities.modes:\n    request.mode = \"inpaint\"\nelse:\n    request.mode = \"text2img\"","handlingStrategy":"validation","validationCode":"if request.mode not in request.model.capabilities.modes:\n    request.mode = request.model.capabilities.modes[0]","typeGuard":"def mode_supported(model, mode: str) -> bool:\n    return mode in model.capabilities.modes","tryCatchPattern":"try:\n    result = service.generate(request)\nexcept ExternalProviderCapabilityError:\n    request.mode = request.model.capabilities.modes[0]\n    result = service.generate(request)","preventionTips":["Derive the mode selector UI from model.capabilities.modes","Reset mode to a supported default whenever the selected model changes","Keep model capability metadata refreshed from the provider","Unit-test workflow templates against each model's capability set"],"tags":["validation","capability-mismatch","external-generation"],"backgroundTag":"unsupported-capability","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}