xtekky/gpt4free · error · ProviderException

No valid Yupp accounts available

Error message

No valid Yupp accounts available

What it means

Raised as ProviderException inside the account-rotation loop when get_best_yupp_account() returns None. Accounts exist in YUPP_ACCOUNTS but none qualifies as usable — typically all have been marked failed (error_count too high), are rate-limited, or have insufficient credits — so the loop cannot even attempt a request.

Source

Thrown at g4f/Provider/Yupp.py:607

        url_uuid = conversation.url_uuid if conversation else None
        is_new_conversation = url_uuid is None

        prompt = kwargs.get("prompt")
        if prompt is None:
            if is_new_conversation:
                prompt = format_messages_for_yupp(messages)
            else:
                prompt = get_last_user_message(messages, prompt)

        log_debug(
            f"Use url_uuid: {url_uuid}, Formatted prompt length: {len(prompt)}, Is new conversation: {is_new_conversation}"
        )

        max_attempts = len(YUPP_ACCOUNTS)
        for attempt in range(max_attempts):
            account = await get_best_yupp_account()
            if not account:
                raise ProviderException("No valid Yupp accounts available")

            try:
                scraper = create_scraper()
                if proxy:
                    scraper.proxies = {"http": proxy, "https": proxy}

                credits = await get_credits(scraper, account)
                log_debug(f"Account ...{account['token'][-4:]} has {credits} credits")
                if credits is not None and credits <= 100:
                    log_debug(
                        f"Account ...{account['token'][-4:]} has low credits, rotating"
                    )
                    async with account_rotation_lock:
                        account["error_count"] += 1
                    continue

                # Initialize token extractor for automatic token swapping
                token_extractor = get_token_extractor(

View on GitHub (pinned to 973504e177)

Solutions

  1. Provide fresh tokens: set YUPP_API_KEY to a comma-separated list of new session tokens to repopulate YUPP_ACCOUNTS
  2. Wait for rate-limit windows to pass so failed-account state resets, then retry
  3. Reduce request volume or add backoff between Yupp calls
  4. Fall back to another provider via g4f's provider fallback/RetryProvider instead of hammering Yupp

Example fix

# before
for _ in range(100):
    resp = await client.chat.completions.create(model='gpt-4o', provider='Yupp', messages=msgs)

# after
from g4f.Provider import IterListProvider
client = Client(provider=IterListProvider([Yupp, Cloudflare], shuffle=False))
Defensive patterns

Strategy: fallback

Validate before calling

# pre-flight: confirm at least one account is selectable
from g4f.Provider.Yupp import YUPP_ACCOUNTS, get_best_yupp_account
usable = [a for a in YUPP_ACCOUNTS if a.get('error_count', 0) < 3]
if not usable:
    # refresh tokens or choose another provider

Try / catch

try:
    resp = await create(..., provider='Yupp')
except ProviderException as e:
    if 'No valid Yupp accounts' in str(e):
        os.environ['YUPP_API_KEY'] = fresh_tokens()  # then retry once

Prevention

When it happens

Trigger: Repeated Yupp requests where every account accumulates errors or runs out of credits (>100-credit threshold triggers rotation, exhausted accounts get excluded), leaving get_best_yupp_account() with no candidate on a subsequent iteration.

Common situations: Heavy automated usage draining all accounts' credits; a Cloudflare/site change marking every token as failed; a single shared token reused across many workers until rate-limited.

Related errors


AI-assisted analysis of xtekky/gpt4free@973504e177 (2026-08-14). Data as JSON: /api/errors/fadadda1f7225d85. Report an issue: GitHub.