xtekky/gpt4free · error · RuntimeError
{error}
Error message
{error} What it means
Raised when the Bing Image Creator results page returns a JSON body whose errorMessage is anything other than "Pending". The raw errorMessage string from Bing is passed through verbatim as the RuntimeError message, so the text is whatever the upstream service reported. It indicates Bing explicitly rejected or failed the generation request.
Source
Thrown at g4f/Provider/needs_auth/bing/create_images.py:141
if time.time() - start_time > timeout:
raise RuntimeError(f"Timeout error after {timeout} sec")
async with session.get(polling_url) as response:
if response.status != 200:
raise RuntimeError(f"Polling images faild. Code: {response.status}")
text = await response.text()
if not text or "GenerativeImagesStatusPage" in text:
await asyncio.sleep(1)
else:
break
error = None
try:
error = json.loads(text).get("errorMessage")
except Exception:
pass
if error == "Pending":
raise RuntimeError("Prompt is been blocked")
elif error:
raise RuntimeError(error)
return read_images(text)
def read_images(html_content: str) -> List[str]:
"""
Extracts image URLs from the HTML content.
Args:
html_content (str): HTML content containing image URLs.
Returns:
List[str]: A list of image URLs.
"""
soup = BeautifulSoup(html_content, "html.parser")
tags = soup.find_all("img", class_="mimg")
if not tags:
tags = soup.find_all("img", class_="gir_mmimg")
images = [img["src"].split("?w=")[0] for img in tags]View on GitHub (pinned to 973504e177)
Solutions
- Read the propagated errorMessage string — it is Bing's own text and states the actual cause
- Refresh Bing cookies (the _U cookie) if the message hints at auth/session issues
- Regenerate the image request to get a fresh request id instead of re-polling an old one
- Fall back to another image provider if the message indicates a permanent rejection
Defensive patterns
Strategy: fallback
Try / catch
try:
images = await create_images(client, prompt)
except RuntimeError as e:
# e carries Bing's own errorMessage text
logger.warning("bing upstream error: %s", e)
images = await fallback_provider(prompt) Prevention
- Treat the propagated errorMessage as authoritative Bing output for diagnosis
- Keep cookies fresh to avoid session-related errorMessages
- Route image traffic through a provider-abstraction layer with fallbacks
When it happens
Trigger: Calling Bing image creation where the async results endpoint returns JSON like {"errorMessage": "..."} with a non-Pending value (e.g. moderation rejection, internal Bing error, expired request id).
Common situations: Expired cookies for the Bing session, request ids polled after their validity window, upstream Bing service errors, or moderation messages other than Pending.
Related errors
- Prompt is been blocked
- Missing "_U" cookie
- No coins left. Log in with a different account or wait a whi
- Create images failed: {error}
- Create images failed. Code: {response.status}
AI-assisted analysis of xtekky/gpt4free@973504e177 (2026-08-14).
Data as JSON: /api/errors/5b241b71d1798a82.
Report an issue: GitHub.