{"record":{"id":"3b4060e1aee567e2","repo":"xtekky/gpt4free","slug":"prompt-is-been-blocked","errorCode":null,"errorMessage":"Prompt is been blocked","messagePattern":"Prompt is been blocked","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"g4f/Provider/needs_auth/bing/create_images.py","lineNumber":139,"sourceCode":"    start_time = time.time()\n    while True:\n        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:","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/xtekky/gpt4free/blob/973504e1770928ed5fb82f43da528f441ad9ddc3/g4f/Provider/needs_auth/bing/create_images.py#L121-L157","documentation":"Raised by create_images() after the Bing Image Creator polling loop finishes and the returned page body parses as JSON containing errorMessage == \"Pending\". Bing reports this status when the image generation request was accepted but the prompt was flagged/blocked and never completed. The library surfaces it as a RuntimeError, meaning the request cannot succeed by retrying the same prompt.","triggerScenarios":"Calling g4f image generation with the Bing provider where the polling URL (/images/create/async/results/{request_id}) returns a JSON body with errorMessage \"Pending\" after theGenerativeImagesStatusPage polling loop breaks.","commonSituations":"Prompts containing content that trips Bing's content moderation (violence, celebrities, nsfw-adjacent terms, certain brand names); also occurs when Bing A/B flags harmless prompts (photo-realistic person descriptions) or regional policy differences.","solutions":["Rephrase the prompt to remove flagged terms (names of real people, violence, sexual wording)","Try a different image provider (e.g. g4f image models not routed through Bing)","Check the full prompt including negative prompt fields for moderated keywords","Retry later — Bing moderation is sometimes transient"],"exampleFix":"// before\nimages = create_images(client, \"realistic photo of [celebrity name]\")\n// after\nimages = create_images(client, \"realistic portrait of a person in a studio\")","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    images = await create_images(client, prompt)\nexcept RuntimeError as e:\n    if \"Prompt is been blocked\" in str(e):\n        # moderation: do not retry same prompt unchanged\n        images = await create_images(client, sanitize(prompt))\n    else:\n        raise","preventionTips":["Filter prompts for names of real people, violence and sexual terms before sending to Bing","Wrap Bing image calls so moderation failures fall back to another image provider","Log the prompt on failure to build a deny-list of flagged vocabulary"],"tags":["bing","image-generation","content-moderation","runtime-error"],"backgroundTag":null,"analyzedSha":"973504e1770928ed5fb82f43da528f441ad9ddc3","analyzedAt":"2026-08-14T23:45:32.408Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}