{"record":{"id":"d9c7eeb95482bf9d","repo":"xtekky/gpt4free","slug":"bad-images-found","errorCode":null,"errorMessage":"Bad images found","messagePattern":"Bad images found","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"g4f/Provider/needs_auth/bing/create_images.py","lineNumber":161,"sourceCode":"\n\ndef read_images(html_content: str) -> List[str]:\n    \"\"\"\n    Extracts image URLs from the HTML content.\n\n    Args:\n        html_content (str): HTML content containing image URLs.\n\n    Returns:\n        List[str]: A list of image URLs.\n    \"\"\"\n    soup = BeautifulSoup(html_content, \"html.parser\")\n    tags = soup.find_all(\"img\", class_=\"mimg\")\n    if not tags:\n        tags = soup.find_all(\"img\", class_=\"gir_mmimg\")\n    images = [img[\"src\"].split(\"?w=\")[0] for img in tags]\n    if any(im in BAD_IMAGES for im in images):\n        raise RuntimeError(\"Bad images found\")\n    if not images:\n        raise RuntimeError(\"No images found\")\n    return images\n","sourceCodeStart":143,"sourceCodeEnd":165,"githubUrl":"https://github.com/xtekky/gpt4free/blob/973504e1770928ed5fb82f43da528f441ad9ddc3/g4f/Provider/needs_auth/bing/create_images.py#L143-L165","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"for attempt in range(3):\n    try:\n        images = await create_images(client, prompt)\n        break\n    except RuntimeError as e:\n        if \"Bad images found\" in str(e) and attempt < 2:\n            continue  # partial generation failure is often non-deterministic\n        raise","preventionTips":["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"],"tags":["bing","image-generation","content-moderation","validation"],"backgroundTag":null,"analyzedSha":"973504e1770928ed5fb82f43da528f441ad9ddc3","analyzedAt":"2026-08-14T23:45:32.408Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}