xtekky/gpt4free · error · MissingAuthError
No authentication arguments found.
Error message
No authentication arguments found.
What it means
LMArena.get_quota() reads persisted auth arguments (cookies/tokens) from the provider cache file via read_args(); when no args dict is available it raises MissingAuthError. It signals that the provider has never been authenticated, so quota counting (number of cookies per key) is impossible.
Source
Thrown at g4f/Provider/needs_auth/LMArena.py:549
@classmethod
def read_args(cls, args: dict = {}):
cache_file = cls.get_cache_file()
if not args and cache_file.exists():
try:
with cache_file.open("r") as f:
args = json.load(f)
except json.JSONDecodeError:
debug.log(f"Cache file {cache_file} is corrupted, removing it.")
cache_file.unlink()
args = None
return args
@classmethod
async def get_quota(cls, **kwargs):
args = cls.read_args()
if not args:
raise MissingAuthError("No authentication arguments found.")
return {key: len(value) if value else 0 for key, value in args.items()}
@classmethod
async def create_async_generator(
cls,
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):View on GitHub (pinned to 973504e177)
Solutions
- Run one authenticated request first (with nodriver installed) so LMArena writes the args cache file, then call get_quota()
- Pass credentials directly via lmarena_args kwarg or place a valid args JSON at the cache file path (cls.get_cache_file())
- Install the nodriver extra (pip install g4f[nodriver]) so the provider can harvest args from a headless browser session
Example fix
// before
quota = await LMArena.get_quota() # raises MissingAuthError
// after
# authenticate once (opens browser via nodriver) before asking for quota
await LMArena.create_async_generator(model='...', messages=[{'role':'user','content':'hi'}]).__anext__()
quota = await LMArena.get_quota() Defensive patterns
Strategy: validation
Validate before calling
from g4f.Provider.needs_auth.LMArena import LMArena
args = LMArena.read_args()
if not args:
# authenticate before asking for quota
await LMArena.create_async_generator(model=list(await LMArena.get_models_async())[0], messages=[{'role': 'user', 'content': 'ping'})).__anext__()
quota = await LMArena.get_quota() Type guard
def has_lmarena_args(args) -> bool:
return isinstance(args, dict) and len(args) > 0 Try / catch
from g4f.errors import MissingAuthError
try:
quota = await LMArena.get_quota()
except MissingAuthError:
quota = None # not authenticated yet; run one authed request first Prevention
- Seed the args cache with one authenticated request before monitoring quota
- Keep the cache file path stable across deployments (same HOME)
- Pass lmarena_args explicitly in stateless environments
When it happens
Trigger: Calling get_quota() before any successful create_async_generator() run, when the cache file does not exist, was corrupted and deleted (json.JSONDecodeError path unlinks it), or when neither lmarena_args nor kwargs supplied credentials.
Common situations: Fresh install with no prior browser login; a corrupted cache file was auto-removed; CI environments with a clean HOME so the .config/g4f cache path is empty.
Understand the failure class
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
Related errors
- No response
- Failed to get download URL
- No auth file found and nodriver is not available.
- API key is required.
- Invalid response: {last_msg}
AI-assisted analysis of xtekky/gpt4free@973504e177 (2026-08-14).
Data as JSON: /api/errors/6fdb20767727541d.
Report an issue: GitHub.