Your request was rejected by the safety system — gpt-image API moderation_blocked, explained
The exact error
Your request was rejected by the safety system
What it means
The request reached a GPT Image model and OpenAI’s content moderation refused it. OpenAI’s image generation guide says all prompts and generated images are filtered in accordance with its content policy, and that user-correctable image failures may come back with error.type set to image_generation_user_error. A safety refusal carries error.code set to moderation_blocked. The guide calls error.code the stable discriminator for programmatic handling, so match on the code, not on the message text.
A concrete case is documented in a public GitHub issue on the ArkeStudio project (September 2026). The app composed a prompt itself, attached three character reference images, and posted it to v1/images/edits with gpt-image-2. OpenAI answered with HTTP 400, type: image_generation_user_error, code: moderation_blocked, and a moderation_details object showing moderation_stage: "output" and categories: ["other"]. The issue author traced the refusal to how the app’s own prompt template framed the scene, not to the project’s premise.
How to confirm it’s this
Read the error body, not just the status code. In the same issue, the app’s UI had reduced the failure to “image generation failed (HTTP 400)”, which told the user nothing actionable. Check for:
error.codeequal tomoderation_blockederror.typeequal toimage_generation_user_error- an optional
error.moderation_detailsobject
Per the image generation guide, moderation_details.moderation_stage is one of:
input— the block came from the prompt or request inputs, including input imagesoutput— the block came from a generated image or a downstream output moderation stageunknown— a rare fallback when provenance is hard to determine
categories holds coarse public labels; the guide gives harassment, self-harm, sexual and violence as examples, and the ArkeStudio report shows other can appear as well. The guide says this object provides coarse debugging context without exposing internal classifier labels or scores, so do not expect a score or a flagged word.
Fix
Change the request, then send it again. The guide recommends keeping the primary end-user message generic and using moderation_details for developer logs, support workflows and light remediation hints. A condensed version of its JavaScript example:
try {
await openai.images.generate({ model: 'gpt-image-2', prompt });
} catch (error) {
if (error?.code !== 'moderation_blocked') throw error;
const details = error.error?.moderation_details;
console.error('Image generation blocked', {
request_id: error?.requestID,
code: error?.code,
moderation_details: details,
});
// stage "input": revise the prompt or input images
// stage "output": the generated result was blocked; change the prompt
}
The guide notes that the same pattern applies to generations, edits, and Responses API tool calls that generate images.
Where to look when revising:
- Input stage: everything your code sends, not only what the user typed. Templates, truncated excerpts and reference images all count as request inputs.
- Output stage: the prompt was accepted but the image it produced was not. Rewrite what the scene depicts rather than rewording the same scene.
- Generated prompts: if an LLM or a template builds the prompt, log the final string. In the ArkeStudio case the problem sat in text the app added, and the issue asks for a distinct user-facing message for
moderation_blockedinstead of a bare HTTP code.
The guide also documents a moderation parameter for GPT Image models with two values: auto (the default, standard filtering) and low (less restrictive filtering). It is a documented strictness setting, not a way around the policy: per the guide, all prompts and generated images are filtered in accordance with the content policy either way.
Retry or not
No, not unchanged. The guide separates these failures from transient ones: retry rate-limit and server errors with backoff, but don’t automatically retry quota errors or image generation user errors that require changing the request, and don’t retry image_generation_user_error without modifying the prompt or input images.
For an agent, treat moderation_blocked as terminal for that exact payload. Surface it (with the stage), or make one deliberate, modified attempt. A retry loop on the same input only repeats the refusal.
When it’s not this
content_policy_violationwith the wording “rejected as a result of our safety system” is the DALL·E-era code. OpenAI’s deprecations page listsdall-e-2anddall-e-3as removed from the API on 2026-05-12, so handlers written for that code and wording will not match this error. See content_policy_violation.- A 403 about organization verification is an access problem, not a moderation decision.
- A 429 is throughput or quota, never content.
- Other providers refuse images with different codes and shapes; don’t reuse this handler for them.
Related errors
- content_policy_violation (DALL·E era)
- Your organization must be verified to use the model
- Rate limit exceeded for images per minute
- Google image safety block
- Google prohibited image content
- fal content policy violation
Error text last verified against the sources below on .