{"record":{"id":"ca210a215c496831","repo":"xtekky/gpt4free","slug":"phindai-api-returned-success-false-data","errorCode":null,"errorMessage":"PhindAi API returned success=False: {data}","messagePattern":"PhindAi API returned success=False: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"g4f/Provider/PhindAi.py","lineNumber":71,"sourceCode":"                    raise RuntimeError(\"Failed to extract nonce from PhindAi response\")\n                nonce = match.group(1)\n\n            # 2. Fetch the response\n            ajax_url = f\"{cls.url}/wp-admin/admin-ajax.php\"\n            payload = {\"action\": \"phind_ai_send\", \"nonce\": nonce, \"message\": prompt}\n\n            async with session.post(ajax_url, data=payload) as response:\n                await raise_for_status(response)\n                try:\n                    data = await response.json()\n                except json.JSONDecodeError:\n                    text = await response.text()\n                    raise RuntimeError(\n                        f\"Failed to decode JSON from PhindAi response: {text}\"\n                    )\n\n                if not data.get(\"success\"):\n                    raise RuntimeError(f\"PhindAi API returned success=False: {data}\")\n\n                response_text = data.get(\"data\", {}).get(\"response\", \"\")\n                return response_text\n","sourceCodeStart":53,"sourceCodeEnd":75,"githubUrl":"https://github.com/xtekky/gpt4free/blob/973504e1770928ed5fb82f43da528f441ad9ddc3/g4f/Provider/PhindAi.py#L53-L75","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before - reusing one session/nonce for many prompts\nasync with StreamSession(...) as s:\n    for p in prompts:\n        ...\n\n# after - new impersonated session per request\nfor p in prompts:\n    async with StreamSession(headers=headers, impersonate='chrome') as s:\n        await PhindAi.create_async_generator(model, [{'role':'user','content':p}])\n    await asyncio.sleep(1)","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    result = await PhindAi.create_async_generator(model, messages)\nexcept RuntimeError as e:\n    if 'success=False' in str(e) and 'nonce' in str(e).lower():\n        await asyncio.sleep(3)\n        result = await PhindAi.create_async_generator(model, messages)  # fresh nonce\n    else:\n        raise","preventionTips":["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"],"tags":["phind","nonce","rate-limit","scraping","api-response"],"backgroundTag":null,"analyzedSha":"973504e1770928ed5fb82f43da528f441ad9ddc3","analyzedAt":"2026-08-14T23:45:32.408Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}