xtekky/gpt4free · error · RuntimeError
Bad images found
Error message
Bad images found
What it means
Raised by read_images() when any extracted image URL matches a entry in the module-level BAD_IMAGES list. Bing serves known placeholder/error thumbnails (data-href style blank images) when individual generations fail while the page still renders; the library detects these and rejects the whole batch rather than returning broken URLs.
Source
Thrown at g4f/Provider/needs_auth/bing/create_images.py:161
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]
if any(im in BAD_IMAGES for im in images):
raise RuntimeError("Bad images found")
if not images:
raise RuntimeError("No images found")
return images
View on GitHub (pinned to 973504e177)
Solutions
- Rephrase the prompt — one or more of the four generated images likely failed moderation
- Retry the generation request; partial failures are often non-deterministic
- Update g4f — new BAD_IMAGES entries are added as Bing introduces new placeholders
- Use a different image provider if it fails consistently for the same prompt
Defensive patterns
Strategy: retry
Try / catch
for attempt in range(3):
try:
images = await create_images(client, prompt)
break
except RuntimeError as e:
if "Bad images found" in str(e) and attempt < 2:
continue # partial generation failure is often non-deterministic
raise Prevention
- Retry once or twice — individual image failures are frequently transient
- Soften prompts that trip per-image moderation
- Keep g4f updated so the BAD_IMAGES list matches Bing's current placeholders
When it happens
Trigger: Bing returns a results page whose <img class="mimg"> or <img class="gir_mmimg"> src attributes include one of the hardcoded BAD_IMAGES placeholder URLs.
Common situations: Some images in a multi-image batch were blocked or failed server-side; Bing UI changes adding new placeholder URLs not yet in BAD_IMAGES; partial moderation of a prompt.
Related errors
- Prompt is been blocked
- No media files provided for image generation.
- Missing "_U" cookie
- No coins left. Log in with a different account or wait a whi
- Create images failed: {error}
AI-assisted analysis of xtekky/gpt4free@973504e177 (2026-08-14).
Data as JSON: /api/errors/d9c7eeb95482bf9d.
Report an issue: GitHub.