Claude Code · Requests and models
API Error: Output blocked by content filtering policy
Claude Code’s “Output blocked by content filtering policy” means Anthropic’s output filter stopped a reply that was reproducing existing text, such as a licence file.
Message
The exact error
API Error: Output blocked by content filtering policyAlso appears as:
- Raw API response (reported on GitHub)
- API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"Output blocked by content filtering policy"},"request_id":"req_…"}
- Plain form
- API Error: 400 Output blocked by content filtering policy
Meaning
What does “Output blocked by content filtering policy” mean?
The message comes from the Anthropic API, not from Claude Code. While Claude streams its reply, an output-side filter checks what it is writing; when the filter stops the response, the API returns this error instead of the rest of the reply. If the filter stops a response early, Claude Code re-sends the request once on its own, so by the time you see the message the second attempt was blocked too. It isn’t a setup fault: the usual cause is a reply that was about to reproduce a long span of existing text word for word.
Causes
What triggers it in Claude Code?
- Writing out a full licence text, such as GPL, AGPL, MPL, MIT or BSL (many reports, for example anthropics/claude-code #12705)
- Standard community files copied from a template, such as a Contributor Covenant
CODE_OF_CONDUCT.md - Transcribing a PDF, paper or web page into Markdown word for word
- Echoing back a long block of text that is already in the conversation
Fix
How do I fix it?
Add licences and standard files without Claude typing them
Download the official text with a command, or add the file yourself, then continue the session. On GitHub you can also use Add file → Create new file, name it
LICENSEand click Choose a license template. Once the file exists, Claude can read it and add short licence headers or README changes.macOS / Linux curl -fsSL https://www.gnu.org/licenses/gpl-3.0.txt -o LICENSEWindows PowerShell curl.exe -fsSL https://www.gnu.org/licenses/gpl-3.0.txt -o LICENSECopy text with a script, not through the reply
For transcription or data extraction, ask Claude to write a small script (for example with
pdftotextor a parser) that reads the source and writes the output files. Claude’s output is then new code, and the original text moves file to file without passing through the model’s reply. Check the result with counts or a diff rather than asking Claude to print it back.Step back past the trigger
The request that triggered the block stays in the conversation, so “continue” usually fails the same way. Press Esc twice or run
/rewindto return to a checkpoint before that request and give a different instruction, or run/clearto start a fresh conversation.Rephrase
If you weren’t asking for existing text, reword your last message or take a different approach to the task.
Don’t do this
- Encoding tricks (base64 and similar) to get the text past the filter. Results are mixed, and Anthropic warns that deliberately trying to extract copyrighted content can lead to a warning or account suspension.
Explained
Why does Claude block my output?
Anthropic says these blocks “generally arise from Anthropic’s efforts to prevent Claude from being used to replicate or regurgitate pre-existing materials” and don’t reflect a judgement about whether your content is acceptable. The filter judges the output, not your intent or the text’s licence: open-source licences, public-domain text and your own documents can all trip it when Claude is about to emit a long passage that closely matches something that already exists.
Because the trigger is the shape of the task, the block repeats for as long as the conversation keeps asking for that text. Anthropic also notes that some people hit these blocks without meaning to reproduce anything; reworking the request is the fix in both cases. If the conversation is getting long as well, see Prompt is too long.
Explained
Is it the same as a Usage Policy refusal?
No. “<model> can’t help with this. Start a new session to continue.” (formerly “Claude Code is unable to respond to this request, which appears to violate our Usage Policy”) and “<model>’s safeguards flagged this message” are separate refusals with their own causes in Anthropic’s error reference. “Output blocked by content filtering policy” is specifically the output filter on reproduced text. Auto mode’s own safety check fails differently again: see Auto mode is unavailable.
FAQ
Questions people ask
Why does Claude Code block me from creating a LICENSE file?
Full licence texts such as GPL, AGPL, MPL or MIT are long, widely published documents, so asking Claude to type one out is exactly the verbatim reproduction the output filter watches for. The filter can’t see that the licence permits copying. Download the official text with a command, or add the file with GitHub’s licence template picker, then let Claude carry on with headers and README changes.
Does retrying fix “Output blocked by content filtering policy”?
Usually not. Claude Code already re-sends the request once when the filter stops a response early. If the task still asks Claude to reproduce the same text, every retry, “continue” message or subagent hits the same filter, because they are all ordinary API calls. Rewind to before the request, or change the task so the text doesn’t pass through Claude’s reply.
Can I turn off Claude’s content filter?
No. The filter runs on Anthropic’s side, on the model’s output, so there is no Claude Code setting, flag or environment variable that disables it. What you can change is the task: fetch or copy existing text with a command or script instead of asking Claude to write it out.
Can I get banned for “Output blocked by content filtering policy”?
Anthropic’s help article says that if you are trying to elicit copyrighted content it may warn you or, after repeated violations, suspend or terminate the account. Hitting the filter by accident while adding a licence file or writing ordinary code is a different case: rework the request and carry on.
Related
Related errors
Keep exploring