{"record":{"id":"7e1901c1935e5853","repo":"xtekky/gpt4free","slug":"no-auth-file-found-and-nodriver-is-not-available","errorCode":null,"errorMessage":"No auth file found and nodriver is not available.","messagePattern":"No auth file found and nodriver is not available\\.","errorType":"exception","errorClass":"MissingRequirementsError","httpStatus":null,"severity":"error","filePath":"g4f/Provider/needs_auth/LMArena.py","lineNumber":573,"sourceCode":"        model: str,\n        messages: Messages,\n        conversation: JsonConversation = None,\n        media: MediaListType = None,\n        proxy: str = None,\n        timeout: int = None,\n        **kwargs,\n    ) -> AsyncResult:\n        prompt = get_last_user_message(messages)\n        cache_file = cls.get_cache_file()\n        args = cls.read_args(kwargs.get(\"lmarena_args\", {}))\n        _need_clear_cookies = False\n        for _ in range(2):\n            if args:\n                pass\n            elif has_nodriver:\n                args = await cls.get_args_from_nodriver(proxy, _need_clear_cookies)\n            else:\n                raise MissingRequirementsError(\n                    \"No auth file found and nodriver is not available.\"\n                )\n\n            if not cls._models_loaded:\n                # change to async\n                await cls.get_models_async()\n\n            def get_mode_id(_model):\n                model_id = None\n                # if not model:\n                #     model = cls.default_model\n                if _model in cls.model_aliases:\n                    _model = cls.model_aliases[_model]\n                if _model in cls.text_models:\n                    model_id = cls.text_models[_model]\n                elif _model in cls.image_models:\n                    model_id = cls.image_models[_model]\n                elif _model in cls.video_models:","sourceCodeStart":555,"sourceCodeEnd":591,"githubUrl":"https://github.com/xtekky/gpt4free/blob/973504e1770928ed5fb82f43da528f441ad9ddc3/g4f/Provider/needs_auth/LMArena.py#L555-L591","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\n$ pip install g4f  # MissingRequirementsError at runtime\n\n# after\n$ pip install 'g4f[nodriver]'\n$ python -c \"import nodriver; print('ok')\"","handlingStrategy":"validation","validationCode":"try:\n    import nodriver\n    has_nodriver = True\nexcept ImportError:\n    has_nodriver = False\nfrom g4f.Provider.needs_auth.LMArena import LMArena\nif not LMArena.read_args() and not has_nodriver:\n    raise SystemExit('Install g4f[nodriver] or provide lmarena_args before using LMArena')","typeGuard":"def lmarena_ready(args, has_nodriver: bool) -> bool:\n    return bool(args) or has_nodriver","tryCatchPattern":"from g4f.errors import MissingRequirementsError\ntry:\n    resp = await client.chat.completions.create(model='...', messages=msgs)\nexcept MissingRequirementsError as e:\n    if 'nodriver' in str(e):\n        subprocess.run([sys.executable, '-m', 'pip', 'install', 'g4f[nodriver]'])\n    raise","preventionTips":["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"],"tags":["lmarena","optional-dependency","nodriver","auth"],"backgroundTag":null,"analyzedSha":"973504e1770928ed5fb82f43da528f441ad9ddc3","analyzedAt":"2026-08-14T23:45:32.408Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}