{"record":{"id":"ee0c9beb704f92b7","repo":"xtekky/gpt4free","slug":"no-providers-available","errorCode":null,"errorMessage":"No providers available","messagePattern":"No providers available","errorType":"exception","errorClass":"RetryNoProviderError","httpStatus":null,"severity":"error","filePath":"g4f/providers/retry_provider.py","lineNumber":250,"sourceCode":"            providers (List[Type[BaseProvider]]): List of providers to use.\n            shuffle (bool): Whether to shuffle the providers list.\n            single_provider_retry (bool): Whether to retry a single provider if it fails.\n            max_retries (int): Maximum number of retries for a single provider.\n        \"\"\"\n        super().__init__(providers, shuffle)\n        self.single_provider_retry = single_provider_retry\n        self.max_retries = max_retries\n\n    async def create_async_generator(\n        self, model: str, messages: Messages, **kwargs\n    ) -> AsyncResult:\n        exceptions = {}\n        started = False\n\n        if self.single_provider_retry:\n            providers = self.get_providers()\n            if not providers:\n                raise RetryNoProviderError(\"No providers available\")\n            provider = providers[0]\n            self.last_provider = provider\n            for attempt in range(self.max_retries):\n                try:\n                    debug.log(\n                        f\"Using {provider.__name__} provider (attempt {attempt + 1})\"\n                    )\n                    method = get_async_provider_method(provider)\n                    response = method(model=model, messages=messages, **kwargs)\n                    async for chunk in response:\n                        yield chunk\n                        if is_content(chunk):\n                            started = True\n                    if started:\n                        return\n                except Exception as e:\n                    exceptions[provider.__name__] = e\n                    if debug.logging:","sourceCodeStart":232,"sourceCodeEnd":268,"githubUrl":"https://github.com/xtekky/gpt4free/blob/973504e1770928ed5fb82f43da528f441ad9ddc3/g4f/providers/retry_provider.py#L232-L268","documentation":"RetryNoProviderError raised in BaseRetryProvider.create_async_generator when single_provider_retry mode is on and get_providers() returns an empty list — there is no first provider to retry. Unlike the empty-list constructor error (354), the provider set can also be emptied at call time by filtering logic inside get_providers().","triggerScenarios":"Calling a RetryProvider subclass with single_provider_retry=True whose provider list became empty after runtime filtering (e.g. all providers marked not working or excluded), so providers[0] would be invalid.","commonSituations":"Custom get_providers() overrides that filter by health/status flags and filter everything out during an outage; constructing RetryProvider with an empty list bypassing the base check via subclass; providers disabled at runtime by ErrorCounter-driven logic.","solutions":["Check what get_providers() returns for your RetryProvider instance before the call, and restore at least one eligible provider.","Loosen or fix the filter inside get_providers() so eligible providers are not all excluded.","Construct the retry provider with a known-good list (see error 354) and avoid subclass paths that drop the constructor guard.","Catch RetryNoProviderError in callers as a configuration signal, not a transient failure — retrying unchanged will not help."],"exampleFix":"// before\nchunks = [c async for c in retry_provider.create_async_generator(model, messages)]\n\n// after\nproviders = retry_provider.get_providers()\nif not providers:\n    raise RuntimeError('retry provider has no eligible providers configured')\nchunks = [c async for c in retry_provider.create_async_generator(model, messages)]","handlingStrategy":"validation","validationCode":"providers = retry_provider.get_providers()\nif not providers:\n    raise RuntimeError('no eligible providers; check filters and provider health')","typeGuard":null,"tryCatchPattern":"from g4f.errors import RetryNoProviderError\ntry:\n    result = await retry_provider.create_async_generator(model, messages)\nexcept RetryNoProviderError as e:\n    if 'No providers available' in str(e):\n        logging.error('configuration error: provider list empty at runtime')\n        raise\n    raise","preventionTips":["Audit get_providers()/filter overrides in RetryProvider subclasses.","Do not retry on this error — it is a configuration defect, not a transient fault.","Keep a static fallback provider outside the filtered set."],"tags":["retry","provider-chain","empty-list","configuration","g4f"],"backgroundTag":null,"analyzedSha":"973504e1770928ed5fb82f43da528f441ad9ddc3","analyzedAt":"2026-08-14T23:45:32.408Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}