{"record":{"id":"28b40d65c18b34f0","repo":"xtekky/gpt4free","slug":"model-model-is-not-supported-by-lmarena-provi","errorCode":null,"errorMessage":"Model '{_model}' is not supported by LMArena provider.","messagePattern":"Model '(.+?)' is not supported by LMArena provider\\.","errorType":"exception","errorClass":"ModelNotFoundError","httpStatus":null,"severity":"error","filePath":"g4f/Provider/needs_auth/LMArena.py","lineNumber":594,"sourceCode":"\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:\n                    model_id = cls.video_models[_model]\n                elif _model:\n                    raise ModelNotFoundError(\n                        f\"Model '{_model}' is not supported by LMArena provider.\"\n                    )\n                return model_id\n\n            modelA: str = model\n            modelB: str = kwargs.get(\"modelB\", \"\")\n            modelAId = get_mode_id(modelA)\n            modelBId = get_mode_id(modelB) if modelB else None\n            if modelAId and modelBId:\n                mode = \"side-by-side\"\n            elif modelAId:\n                mode = \"direct-battle\"\n            else:\n                mode = \"battle\"\n            if conversation and getattr(conversation, \"evaluationSessionId\", None):\n                url = cls.post_to_evaluation.format(id=conversation.evaluationSessionId)\n                evaluationSessionId = conversation.evaluationSessionId\n            else:","sourceCodeStart":576,"sourceCodeEnd":612,"githubUrl":"https://github.com/xtekky/gpt4free/blob/973504e1770928ed5fb82f43da528f441ad9ddc3/g4f/Provider/needs_auth/LMArena.py#L576-L612","documentation":"Raised by the get_mode_id() closure in LMArena.create_async_generator. After applying model_aliases, the requested model name was not found in text_models, image_models, or video_models, so it cannot be mapped to an LMArena model ID. ModelNotFoundError tells the caller the model string is invalid for this provider.","triggerScenarios":"Passing a model string that is not in LMArena.get_models() output, e.g. a model name belonging to another provider, a renamed/removed arena model, or a typo; also modelB resolution when kwargs['modelB'] names an unknown model.","commonSituations":"Copying model names from other providers ('gpt-4o' style names that LMArena does not expose), using a stale hardcoded model list after LMArena rotated its arena models, or the models list failing to load (so dicts are empty and every name misses).","solutions":["List supported models first and pick from them: models = await LMArena.get_models_async(); use a key from that result","Update g4f — model aliases and ID maps for LMArena change frequently","If the model list is empty, ensure auth worked (models load only after a valid session) and retry","Check model_aliases for the provider to use the accepted alias spelling"],"exampleFix":"# before\nresp = await client.chat.completions.create(model='gpt-4-turbo', messages=msgs)  # not an LMArena model\n\n# after\nmodels = await LMArena.get_models_async()  # or check g4f model listing\nresp = await client.chat.completions.create(model=list(models)[0], messages=msgs)","handlingStrategy":"validation","validationCode":"models = await LMArena.get_models_async()\nif model not in models and model not in LMArena.model_aliases:\n    model = next(iter(models))  # or raise a clear config error","typeGuard":"def model_supported(name: str, models: dict, aliases: dict) -> bool:\n    return name in aliases or name in models","tryCatchPattern":"from g4f.errors import ModelNotFoundError\ntry:\n    resp = await client.chat.completions.create(model=model, messages=msgs)\nexcept ModelNotFoundError:\n    models = await LMArena.get_models_async()\n    resp = await client.chat.completions.create(model=list(models)[0], messages=msgs)","preventionTips":["Resolve models dynamically from get_models_async() instead of hardcoding names","Validate both model and modelB before side-by-side battles","Refresh model lists after g4f updates"],"tags":["lmarena","model-not-found","validation"],"backgroundTag":null,"analyzedSha":"973504e1770928ed5fb82f43da528f441ad9ddc3","analyzedAt":"2026-08-14T23:45:32.408Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}