{"record":{"id":"5b241b71d1798a82","repo":"xtekky/gpt4free","slug":"error","errorCode":null,"errorMessage":"{error}","messagePattern":"\\{error\\}","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"g4f/Provider/needs_auth/bing/create_images.py","lineNumber":141,"sourceCode":"        if time.time() - start_time > timeout:\n            raise RuntimeError(f\"Timeout error after {timeout} sec\")\n        async with session.get(polling_url) as response:\n            if response.status != 200:\n                raise RuntimeError(f\"Polling images faild. Code: {response.status}\")\n            text = await response.text()\n            if not text or \"GenerativeImagesStatusPage\" in text:\n                await asyncio.sleep(1)\n            else:\n                break\n    error = None\n    try:\n        error = json.loads(text).get(\"errorMessage\")\n    except Exception:\n        pass\n    if error == \"Pending\":\n        raise RuntimeError(\"Prompt is been blocked\")\n    elif error:\n        raise RuntimeError(error)\n    return read_images(text)\n\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]","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/xtekky/gpt4free/blob/973504e1770928ed5fb82f43da528f441ad9ddc3/g4f/Provider/needs_auth/bing/create_images.py#L123-L159","documentation":"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.","triggerScenarios":"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).","commonSituations":"Expired cookies for the Bing session, request ids polled after their validity window, upstream Bing service errors, or moderation messages other than Pending.","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"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    images = await create_images(client, prompt)\nexcept RuntimeError as e:\n    # e carries Bing's own errorMessage text\n    logger.warning(\"bing upstream error: %s\", e)\n    images = await fallback_provider(prompt)","preventionTips":["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"],"tags":["bing","image-generation","upstream-error","runtime-error"],"backgroundTag":null,"analyzedSha":"973504e1770928ed5fb82f43da528f441ad9ddc3","analyzedAt":"2026-08-14T23:45:32.408Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}