content_policy_violation on the OpenAI Images API — what the DALL-E error became on gpt-image
The exact error
Error code: 400 - {'error': {'code': 'content_policy_violation', 'message': 'Your request was rejected as a result of our safety system. Your prompt may contain text that is not allowed by our safety system.', 'param': None, 'type': 'invalid_request_error'}} What it means
content_policy_violation was the error code DALL·E returned through the OpenAI API when its safety system refused a request, as HTTP 400 with type: invalid_request_error. Two message variants show up in the OpenAI community forum:
- DALL·E 2 (December 2023 thread): the message above, saying the prompt may contain text the safety system does not allow. The poster’s prompt was a three-word city scene, and the Moderations endpoint returned
flagged: falsefor it. A forum member replied that the image product has its own content filter with a much lower detection threshold than the Moderations endpoint. - DALL·E 3 (February 2024 thread): the message said image descriptions generated from your prompt may contain disallowed text, and added that the request may succeed if retried or if the prompt is adjusted. A forum member explained that DALL·E 3 rewrote prompts on OpenAI’s side, so a short, generic prompt could be expanded into something that tripped the filter.
Both models are now gone. OpenAI’s deprecations page lists dall-e-2 and dall-e-3 as removed from the API on 2026-05-12, with gpt-image-2, gpt-image-1 or gpt-image-1-mini as recommended replacements. The same page schedules gpt-image-1 for shutdown on 2026-10-23 and gpt-image-1-mini and gpt-image-1.5 for 2026-12-01, all with gpt-image-2 as the replacement. New code should target gpt-image-2.
How to confirm it’s this
If content_policy_violation appears in your logs today, work out where it came from:
- Old logs or old code paths. Check the model name in the failing request. A request naming
dall-e-2ordall-e-3is calling a model that has been removed; migrating is the fix, not prompt changes. - Your own error mapping. If your code or a wrapper translates OpenAI errors into its own codes, log the raw response body from OpenAI before trusting the label.
- Another provider. Other image APIs have their own policy errors; check which service actually answered.
OpenAI’s current image generation guide does not mention content_policy_violation. For GPT Image models it documents a different shape for safety refusals:
| DALL·E era (forum reports) | GPT Image models | |
|---|---|---|
error.code | content_policy_violation | moderation_blocked |
error.type | invalid_request_error | image_generation_user_error |
| Stage information | not present in the reported bodies | optional moderation_details.moderation_stage: input, output or unknown |
| Categories | not present in the reported bodies | optional moderation_details.categories |
A public GitHub issue from September 2026 shows gpt-image-2 returning HTTP 400 with moderation_blocked, moderation_stage: "output", and a message that begins “Your request was rejected by the safety system”. The wording differs from the DALL·E message, which read “rejected as a result of our safety system”.
Fix
Update the handler, not the prompt:
- Switch the model to
gpt-image-2if the code still names a DALL·E model. - Match on
error.code === 'moderation_blocked'. The image generation guide callserror.codethe stable discriminator for programmatic handling. - Drop message matching. A regex written for “as a result of our safety system” will not match the GPT Image wording, so the refusal falls through to a generic error branch.
- Use the stage. Per the guide,
inputmeans the prompt or input images were blocked andoutputmeans the generated image was. That tells you whether to revise what you sent or what you asked the model to depict.
The guide recommends keeping the end-user message generic and sending moderation_details to developer logs and support workflows.
Retry or not
No. The DALL·E 3 message itself said a retry might succeed, which fit a model that rewrote prompts on OpenAI’s side. That model is removed, so a retry policy built around that hint is now wrong.
For GPT Image models, the image generation guide says not to automatically retry image_generation_user_error responses without modifying the prompt or input images. An agent should treat a safety refusal as terminal for that exact payload: report it, or make one deliberately changed attempt.
When it’s not this
- HTTP 400 with
billing_hard_limit_reachedalso arrives as aninvalid_request_error, but it is a billing state, not a content decision. - HTTP 403 about organization verification is an access gate on GPT Image models, not a content decision.
- fal and Google have their own safety errors; see the links below.
Related errors
- Your request was rejected by the safety system (moderation_blocked)
- Billing hard limit has been reached
- Your organization must be verified to use the model
- fal content policy violation
- Google image safety block
Error text last verified against the sources below on .
Where these facts come from
- https://community.openai.com/t/dalle-content-policy-violation/539441
- https://community.openai.com/t/dall-e-3-getting-content-policy-violation-error-for-a-simple-prompt/639082
- https://developers.openai.com/api/docs/deprecations
- https://developers.openai.com/api/docs/guides/image-generation
- https://github.com/michaeljosiah/ArkeStudio/issues/906