xtekky/gpt4free · error · RuntimeError
PhindAi API returned success=False: {data}
Error message
PhindAi API returned success=False: {data} What it means
Raised when PhindAi's ajax endpoint returns valid JSON but with success != true. The full data payload is embedded; typical reasons are an invalid nonce (WP ajax rejects the request), rate limiting, or the backend refusing the message content.
Source
Thrown at g4f/Provider/PhindAi.py:71
raise RuntimeError("Failed to extract nonce from PhindAi response")
nonce = match.group(1)
# 2. Fetch the response
ajax_url = f"{cls.url}/wp-admin/admin-ajax.php"
payload = {"action": "phind_ai_send", "nonce": nonce, "message": prompt}
async with session.post(ajax_url, data=payload) as response:
await raise_for_status(response)
try:
data = await response.json()
except json.JSONDecodeError:
text = await response.text()
raise RuntimeError(
f"Failed to decode JSON from PhindAi response: {text}"
)
if not data.get("success"):
raise RuntimeError(f"PhindAi API returned success=False: {data}")
response_text = data.get("data", {}).get("response", "")
return response_text
View on GitHub (pinned to 973504e177)
Solutions
- Read the embedded data field — it names the exact reason (nonce/rate limit/content).
- Retry with a fresh session so a new nonce is fetched per request.
- Slow down request cadence or rotate proxy.
- Shorten/sanitize the prompt if the message content is being refused.
Example fix
# before - reusing one session/nonce for many prompts
async with StreamSession(...) as s:
for p in prompts:
...
# after - new impersonated session per request
for p in prompts:
async with StreamSession(headers=headers, impersonate='chrome') as s:
await PhindAi.create_async_generator(model, [{'role':'user','content':p}])
await asyncio.sleep(1) Defensive patterns
Strategy: try-catch
Try / catch
try:
result = await PhindAi.create_async_generator(model, messages)
except RuntimeError as e:
if 'success=False' in str(e) and 'nonce' in str(e).lower():
await asyncio.sleep(3)
result = await PhindAi.create_async_generator(model, messages) # fresh nonce
else:
raise Prevention
- Never reuse a nonce across requests
- Read embedded data field to classify nonce vs rate-limit refusals
- Back off on rate-limit messages
- Keep prompts within content policy
When it happens
Trigger: POSTing to admin-ajax.php with a stale/incorrect nonce or when the backend throttles: response JSON like {'success': false, 'data': 'nonce verification failed'} or a rate-limit message.
Common situations: Reusing a nonce across sessions (they are short-lived); too many requests per IP per window; long/blocked prompt content rejected server-side; g4f nonce extraction racing with nonce rotation.
Related errors
- Failed to extract nonce from PhindAi response
- Failed to decode JSON from PhindAi response: {text}
- Failed to chat: {response.status} {error_text}
- No response
- {data['code']}:{data['details']}
AI-assisted analysis of xtekky/gpt4free@973504e177 (2026-08-14).
Data as JSON: /api/errors/ca210a215c496831.
Report an issue: GitHub.