Claude Code API Error 400 “Output Blocked by Content Filtering Policy”: How to Fix It

Claude Code API Error 400 “Output Blocked by Content Filtering Policy”: How to Fix It

If Claude Code stops with “API Error: Output blocked by content filtering policy”, the API’s output content filter stopped the response Claude was writing. It is a check on what Claude produces, not a crash, a bug in your project or a problem with your account. When people search for output blocked by content filtering policy in Claude, the cause is usually a request that makes Claude write out a long piece of existing text word for word.

Sending the same request again usually ends the same way, because Claude would try to write the same output. Here is the short fix list:

  • Change what Claude has to write. Ask for a summary, an explanation or a link instead of a full copy.
  • If you need a long existing text in a file, such as a license, have Claude run a command that fetches or copies it, so the text never has to appear in Claude’s response.
  • Press Esc twice or run /rewind to step back before the turn that was blocked, then rephrase.
  • If you can’t tell which turn caused it, run /clear and start fresh in the same project.

This guide is part of our help series. Browse all our Claude Code tutorials for more fixes and how-tos.

Tested with Claude Code v2.1.325 on macOS on November 17, 2026. We did not trigger the block on purpose, so the message text and how Claude Code handles it come from Anthropic’s official documentation. We ran the fixes below for real in a small demo folder, and those terminal captures are real.

Output Blocked by Content Filtering Policy: Quick Summary

QuestionShort answer
Exact messageAPI Error: Output blocked by content filtering policy
What it meansThe API’s output content filter stopped the response Claude was generating
Where the text comes fromThe API, not Claude Code itself
Why “400”?Anthropic lists copyright validation among the checks that return 400 error codes
Does Claude Code retry?Yes, once, if the filter stops the response early; you see the error if the retry is blocked too
Most common triggerAsking Claude to reproduce long existing text, such as a full license, lyrics or someone else’s docs
Fastest fixAsk for a summary or link, or fetch the text with a command
Fix inside a sessionEsc twice or /rewind, then rephrase; /clear as a last resort
Decision diagram for the Claude Code output blocked by content filtering policy error: if you asked for long existing text word for word, fetch it with a command or ask for a summary; if you know the prompt, use /rewind; in a claude -p script start a new run with new wording; otherwise use /clear
Which fix to use when Claude Code says the output was blocked, from the most likely cause down.

What Output Blocked by Content Filtering Means

Anthropic’s Claude Code error reference describes this error in one line: the API’s output content filter stopped the response Claude was generating. It also notes that the message text comes from the API. Claude Code only shows it to you.

The key word is output. Most refusals you may know about are triggered by what you ask. This one is about what Claude was in the middle of writing, which can be a reply, a file or a tool call.

Claude Code error reference page, Output blocked by content filtering policy section, with the message API Error: Output blocked by content filtering policy and the What to do list highlighted
The official entry for this error and its two recommended fixes.

The official “What to do” list is short. It says to rephrase your last message or take a different approach, and to step back to a checkpoint before the blocked turn with Esc twice or /rewind. The rest of this guide explains how to do both well.

Why Searches Call It “API Error 400”

The Claude Code docs don’t print a status code next to this message. On the Claude API side, a 400 invalid_request_error means there is an issue with the format or content of your request.

Claude API errors page with the 400 invalid_request_error entry highlighted: there is an issue with the format or content of your request
On the Claude API, a 400 error covers problems with the format or content of a request.

Anthropic’s guide to streaming refusals is more specific. It lists three ways the API handles refusals, and one of them is “API input and copyright validation”, which returns 400 error codes. That lines up with what most people hit: a request that would make Claude copy protected text.

Claude Platform docs, Current refusal types table, with the row API input and copyright validation, 400 error codes, highlighted
Anthropic’s refusal types table, with copyright validation listed as a 400 error.

Why Claude Code Output Gets Blocked by the Content Filter

Anthropic does not publish a list of exactly what trips the output filter. What we know from the docs is that it acts on the response and that copyright checks are part of the API’s validation. Based on that, these are the situations where you are most likely to see the block:

  • Asking Claude to write a full open-source license, such as MIT, Apache or GPL text, into a LICENSE file.
  • Asking for a standard document word for word, such as a full code of conduct or a long terms-of-service text.
  • Asking for song lyrics, poems or long book passages, even as sample data or test fixtures.
  • Asking Claude to copy large parts of someone else’s documentation or articles into your project.
  • Asking Claude to echo back a long file it read from the web or from another project, line for line.

In each case your request might be perfectly reasonable. You want a license file, not a copyright problem. The block happens because the way you asked forces Claude to type the full text itself.

The output filter cares about what Claude writes. Change what Claude has to write, and the block usually goes away.

How Claude Code Handles the Block

You might not see the error the first time the filter fires. The error reference’s section on automatic retries says that when the output content filter stops a streaming response early, Claude Code re-sends the request once. Early here means before Claude has finished thinking or started any text or tool call.

Claude Code error reference, Automatic retries list, with the bullet highlighted: a streaming response that the output content filter stops is re-sent once, and the error shows if the second response is stopped too
Claude Code retries a filtered response once before it shows you the error.

If the filter stops the second response too, the turn ends with the error. So by the time you read the message, a retry has already failed. That is why simply sending the same prompt again is the least useful thing you can do.

Flow diagram of the Claude Code content filter error: you make a request, Claude starts writing, the filter stops it and Claude Code retries once, then the request is blocked again and the error appears
What happens between your prompt and the error message.

Fix 1: Fetch Long Text With a Command

This is the best fix when you need a long standard text in a file. Instead of asking Claude to type it, ask Claude to run a command that downloads or copies it. The text goes straight from the source into the file, and Claude only has to write a short command.

We tried this in a demo folder with a tiny Node.js project. We asked for an MIT license and told Claude not to type the text itself. Here is the prompt we used:

Add an MIT LICENSE file for "Demo Project". Don't type the license text yourself. Run exactly: curl -s https://api.github.com/licenses/mit | jq -r .body | sed 's/\[year\]/2026/; s/\[fullname\]/Demo Project/' > LICENSE

The command pulls the official MIT text from GitHub’s public licenses API, fills in the year and the name, and saves it to LICENSE. It needs curl and jq, which you can swap for any download tool you like.

Claude Code permission prompt for a Bash command that downloads the MIT license with curl and jq and writes it to LICENSE, with the command and the Do you want to proceed, Yes option highlighted
Claude Code asks before running the command. The license text itself never appears in Claude’s reply.

Claude Code showed the command and asked for approval, as it does for any shell command in the default mode. Our guide to Claude Code permissions explains those prompts. After we chose Yes, the file was written in about five seconds.

Claude Code session after the curl command ran: the output shows a 22-line LICENSE file starting with MIT License, and Claude confirms the text came from the GitHub API
The 22-line license was written by the command. Claude only reported the result.

Claude’s own reply was two short sentences saying the file was created and the text came from the GitHub API. That is the whole point: there was no long passage for the output filter to stop.

Other Ways to Get the Text Without Claude Typing It

  • Copy a license you already have from another project with cp ../other-project/LICENSE .
  • Download a file from its official source with curl -o FILE URL, using a URL you trust.
  • Use your package manager or project generator, which often adds a license for you.
  • Paste the text into the file yourself in your editor, then ask Claude to fill in only the name and year.

Fix 2: Ask for a Summary or a Link Instead of a Copy

Often you don’t need the full text at all. You need to know what it says, or you need Claude to use it. In that case, ask for a summary, an explanation or the source link.

We tested this right after creating the license. We asked a short follow-up and told Claude not to quote the file:

In 3 short bullets, summarize what the license in LICENSE lets people do. Don't quote it.
Claude Code answer with three short bullets summarizing the MIT license: use, copy, modify and sell the software, keep the copyright notice, and no warranty
A three-bullet summary gives you what you need without a word-for-word copy.

The answer came back in two seconds with three plain bullets. This pattern works for docs too. Ask “explain how this API’s pagination works” instead of “paste the pagination section of their docs”.

Here are a few rewrites that keep the goal but change the output:

Instead ofTry
Write the full Apache 2.0 license into LICENSEDownload the Apache 2.0 license into LICENSE with curl
Paste the lyrics of this song as test dataGenerate 10 lines of original sample text as test data
Copy their whole README section into our docsSummarize their setup steps in our own words and link the original
Print this 500-line file exactly as it isShow me the lines that handle login and explain them

Fix 3: Rewind or Clear the Session

The official docs list rewinding as the second fix. If the blocked request is still sitting in your conversation, Claude may keep trying to finish it. Stepping back removes it so you can try a different approach.

  1. With an empty prompt box, press Esc twice, or type /rewind and press Enter.
  2. Pick the prompt that was blocked, or the one just before it.
  3. Choose to restore the conversation, then edit your prompt using one of the rewrites above.
Claude Code Rewind menu listing the two earlier prompts from the demo session and the current point, with the first prompt highlighted
The rewind menu lists each prompt you sent, so you can step back before the one that was blocked.

If there is text in the prompt box, double Esc clears that text instead of opening the menu, so /rewind is the more reliable option. Our full guide to Claude Code checkpoints covers the restore options in detail.

If you can’t tell which turn caused the block, run /clear. It starts a fresh conversation in the same project, and the old one stays available through /resume. Our guide on resuming sessions shows how to find it again later.

Scripts and claude -p

In headless mode there is no rewind menu. Change the prompt so it asks for a command, a summary or a link, and run it again as a new claude -p call. Leave out --continue and --resume on that retry, because they reload the conversation that contained the blocked request.

claude -p "Download the MIT license into LICENSE with curl. Don't type the license text yourself."

Related Errors That Look Similar

A few other messages also mention policy or safety. They have different causes, so check the exact wording before you pick a fix.

Message containsWhat it isWhat to do
Output blocked by content filtering policyThe output filter stopped Claude’s responseChange the output: command, summary or link; /rewind
can't help with this. Start a new session to continueA Usage Policy refusal of the conversation/rewind, /clear or a new session
safeguards flagged this messageA cybersecurity topic flagSee the official error reference for the options
a safety check separate from auto mode blocked this requestEarlier conversation content tripped a safety filter during an auto mode checkSwitch permission mode or start a fresh conversation

The Usage Policy refusal is the one people confuse most often with this error. We cover it in our guide to the usage policy error. For status code problems such as malformed requests or server errors, see our guide to API error 400 and 500.

Try It Yourself

You can practice the main fix without hitting the error. Make an empty test folder, add a small file such as a package.json, start Claude Code there, and send this prompt:

Add an MIT LICENSE file for "My Test Project". Don't type the license text yourself. Download it with curl from https://api.github.com/licenses/mit, use jq to take the .body field, and fill in the year and name with sed.

Approve the command when Claude Code asks, then open LICENSE to check it. Next, ask for a three-bullet summary of the file and notice how short Claude’s answer stays.

Common Mistakes

  • Sending the same prompt again. Claude Code already retried once, and the same request usually produces the same output.
  • Typing “please try again” in the same turn flow. The blocked request is still the task Claude is working on.
  • Asking Claude to “type it slowly” or split the same full text into parts. The goal is to avoid copying, not to sneak it past the filter.
  • Blaming your network or API key. This message is about the content of the response, not your connection or account.
  • Pressing Esc twice with text in the prompt box. That clears the text instead of opening the rewind menu.

Pro Tips

  • Keep standard files like licenses in a template folder, so you can copy them into new projects with one command.
  • Add a line to your project’s CLAUDE.md such as “fetch license and other standard texts with a command; never type them out”.
  • For test data, ask for original sample text instead of real lyrics, quotes or book passages.
  • When you need someone else’s docs, ask Claude to read them and explain the part you need, then link the source.
  • Keep our list of common errors handy for messages that aren’t about content at all.

Content Filtering Error Cheat Sheet

Cheat sheet for the Claude Code output blocked by content filtering policy error: Esc Esc, /rewind, /clear, claude -p without --continue and /feedback to get unstuck, plus curl, cp, summaries, links and smaller asks to avoid the block
What to run when the output is blocked, and how to avoid it next time.

For every other command, keep our commands cheat sheet nearby. You can read the official entry in Anthropic’s error reference and its troubleshooting guide.

Frequently Asked Questions

What does “Output blocked by content filtering policy” mean in Claude Code?

It means the API’s output content filter stopped the response Claude was writing. The message comes from the API, and Claude Code shows it after one automatic retry has also been blocked.

Why does Claude Code block a request for an MIT or GPL license?

A full license is a long existing text, and asking Claude to type it word for word is a common way to trip the output filter. Anthropic lists copyright validation among the API checks that return 400 errors. Download or copy the license with a command instead.

Is my account in trouble?

The error reference describes this as the filter stopping a response. It doesn’t mention any account action. Rephrase your request or take a different approach, as the docs suggest.

Will switching models fix it?

The Claude Code docs don’t list a model switch as a fix for this error. Changing what Claude has to write is the reliable fix, because the filter acts on the output itself.

Can I turn the content filter off?

No setting for that appears in Claude Code’s documentation, and you shouldn’t try to work around it. Use a command, a summary or a link to get what you need.

Conclusion

The “API Error: Output blocked by content filtering policy” message means the API stopped what Claude was writing, usually because the request asked for a long existing text such as a license, lyrics or someone else’s docs to be reproduced word for word. Claude Code has already retried once by the time you see it, so the fix is to change the output: fetch the text with a command like curl, ask for a summary or a link, then use /rewind or /clear to move on from the blocked turn. In our test, a curl command wrote a full MIT license in seconds while Claude’s own reply stayed two sentences long. To see what else Claude AI can do, browse the rest of our guides.

Newsletter

New AI tools in your inbox

The best new tools and the AI news that matters, in one short email. Unsubscribe any time.

Free · No spam · Unsubscribe any time

✓ Looks like you’re subscribed

Loading Google’s sign-up form…

Looks like you’re already subscribed

Thanks for reading! New AI tools and the AI news that matters will land in your inbox.

Not subscribed yet? Refresh the page to load the sign-up form.

The sign-up form couldn’t load. If you use an ad or content blocker, allow news.google.com and reload the page.

Free instant check before you pay. Takes a few seconds.

Scroll to Top