xtekky/gpt4free · error · MissingRequirementsError
No auth file found and nodriver is not available.
Error message
No auth file found and nodriver is not available.
What it means
Raised in LMArena.create_async_generator when no cached auth args exist AND the nodriver package is not installed, so there is no way to obtain a browser session. MissingRequirementsError means the environment lacks an optional dependency needed for this provider, not that authentication failed.
Source
Thrown at g4f/Provider/needs_auth/LMArena.py:573
model: str,
messages: Messages,
conversation: JsonConversation = None,
media: MediaListType = None,
proxy: str = None,
timeout: int = None,
**kwargs,
) -> AsyncResult:
prompt = get_last_user_message(messages)
cache_file = cls.get_cache_file()
args = cls.read_args(kwargs.get("lmarena_args", {}))
_need_clear_cookies = False
for _ in range(2):
if args:
pass
elif has_nodriver:
args = await cls.get_args_from_nodriver(proxy, _need_clear_cookies)
else:
raise MissingRequirementsError(
"No auth file found and nodriver is not available."
)
if not cls._models_loaded:
# change to async
await cls.get_models_async()
def get_mode_id(_model):
model_id = None
# if not model:
# model = cls.default_model
if _model in cls.model_aliases:
_model = cls.model_aliases[_model]
if _model in cls.text_models:
model_id = cls.text_models[_model]
elif _model in cls.image_models:
model_id = cls.image_models[_model]
elif _model in cls.video_models:View on GitHub (pinned to 973504e177)
Solutions
- Install the optional dependency: pip install g4f[nodriver] (or pip install nodriver) and ensure a Chrome/Chromium browser is available
- Alternatively supply credentials without a browser: pass lmarena_args kwarg or copy a valid args JSON to the cache file path returned by LMArena.get_cache_file()
- Verify import success after install: python -c "from g4f.requests import has_nodriver; print(has_nodriver)" (or check g4f's nodriver import) before retrying
Example fix
# before
$ pip install g4f # MissingRequirementsError at runtime
# after
$ pip install 'g4f[nodriver]'
$ python -c "import nodriver; print('ok')" Defensive patterns
Strategy: validation
Validate before calling
try:
import nodriver
has_nodriver = True
except ImportError:
has_nodriver = False
from g4f.Provider.needs_auth.LMArena import LMArena
if not LMArena.read_args() and not has_nodriver:
raise SystemExit('Install g4f[nodriver] or provide lmarena_args before using LMArena') Type guard
def lmarena_ready(args, has_nodriver: bool) -> bool:
return bool(args) or has_nodriver Try / catch
from g4f.errors import MissingRequirementsError
try:
resp = await client.chat.completions.create(model='...', messages=msgs)
except MissingRequirementsError as e:
if 'nodriver' in str(e):
subprocess.run([sys.executable, '-m', 'pip', 'install', 'g4f[nodriver]'])
raise Prevention
- Install g4f with extras: pip install g4f[nodriver]
- Pre-seed auth args in containers where browsers are impractical
- Fail fast at startup by checking read_args()/nodriver availability
When it happens
Trigger: First-ever use of the LMArena provider with no args cache file, no lmarena_args kwarg, and has_nodriver == False because g4f was installed without the [nodriver] extra.
Common situations: Minimal pip install g4f without extras in Docker/CI; nodriver import failing at runtime (missing Chrome/Chromium binary) which makes has_nodriver false; a slim environment where the args cache was never seeded.
Related errors
- Failed to get download URL
- No authentication arguments found.
- Invalid response: {last_msg}
- Failed to obtain Turnstile token for DeepInfra request.
- No response
AI-assisted analysis of xtekky/gpt4free@973504e177 (2026-08-14).
Data as JSON: /api/errors/7e1901c1935e5853.
Report an issue: GitHub.