xtekky/gpt4free · error · ModelNotFoundError
LMArena Beta encountered an error: hasArenaError
Error message
LMArena Beta encountered an error: hasArenaError
What it means
While streaming the chat response from LMArena's Next.js flight protocol, a line prefixed 'a0:' carried the literal JSON string "hasArenaError". This is LMArena's own in-band error signal: the request reached the server and the stream started, but the arena backend rejected or failed the generation. g4f re-raises it as ModelNotFoundError.
Source
Thrown at g4f/Provider/needs_auth/LMArena.py:659
data["modelBMessageId"] = modelBMessageId
yield JsonRequest.from_dict(data)
try:
async with StreamSession(**args, timeout=timeout or 5 * 60) as session:
async with session.post(
url,
json=data,
proxy=proxy,
) as response:
await raise_for_status(response)
args["cookies"] = merge_cookies(args["cookies"], response)
async for chunk in response.iter_lines():
line = chunk.decode()
yield PlainTextResponse(line)
if line.startswith("a0:"):
chunk = json.loads(line[3:])
if chunk == "hasArenaError":
raise ModelNotFoundError(
"LMArena Beta encountered an error: hasArenaError"
)
yield chunk
elif line.startswith("b0:"):
...
elif line.startswith("ag:"):
chunk = json.loads(line[3:])
yield Reasoning(chunk)
elif (
line.startswith("a2:") or line.startswith("b2:")
) and line == 'a2:[{"type":"heartbeat"}]':
# 'a2:[{"type":"heartbeat"}]'
continue
elif line.startswith("a2:"):
chunk = json.loads(line[3:])
__images = [
image.get("image")
for image in chunkView on GitHub (pinned to 973504e177)
Solutions
- Retry with a different model from LMArena.get_models() — often only one arena model is affected
- Retry the same request after a short wait; hasArenaError is frequently transient on the server side
- Simplify the prompt/media payload if the error reproduces only for specific content
- Check LMArena status/changelog and update g4f if the arena protocol changed
Example fix
// before
resp = await client.chat.completions.create(model='arena/model-x', messages=msgs)
// after
# rotate models on failure
for model in ['arena/model-x', 'arena/model-y']:
try:
resp = await client.chat.completions.create(model=model, messages=msgs); break
except ModelNotFoundError: continue Defensive patterns
Strategy: fallback
Try / catch
from g4f.errors import ModelNotFoundError
for model in candidate_models:
try:
resp = await client.chat.completions.create(model=model, messages=msgs)
break
except ModelNotFoundError as e:
if 'hasArenaError' in str(e):
continue # this arena model is failing server-side; try next
raise Prevention
- Keep a list of fallback arena models
- Retry once after a short delay — the error is often transient
- Monitor repeated hasArenaError for a given model to detect deprecation
When it happens
Trigger: POSTing the conversation payload to LMArena succeeds, but during iter_lines() the model A stream ('a0:' prefix) yields the hasArenaError marker — e.g. when the selected model is temporarily disabled, the prompt triggers server-side moderation, or the arena service has an outage.
Common situations: A specific arena model being down or rate-limited server-side; prompts with content the arena refuses; using a model ID that exists in the catalog but is not currently servable; transient platform incidents.
Related errors
- LMArena: {json.loads(line[3:])}
- Invalid response: {last_msg}
- Failed to read response: {chunk.decode(errors='replace')}
- Ratelimit Exceeded!
- {chunk_text}
AI-assisted analysis of xtekky/gpt4free@973504e177 (2026-08-14).
Data as JSON: /api/errors/16346a102966c2d7.
Report an issue: GitHub.