[BUG] Output blocked by content filtering when generating ISO country code dictionary

Resolved 💬 3 comments Opened Feb 19, 2026 by partopronto Closed Feb 23, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Product: Claude Code (CLI) / Claude API

Reproduction:

Ask Claude Code to write a Python dictionary mapping all 199 ISO 3166-1 country names to their alpha-2 codes in a single edit/write operation. For example:

"Add a COUNTRY_NAME_TO_CODE dict to this file with all 199 entries from countries.ts"
The model attempts to output a dict literal like:

COUNTRY_NAME_TO_CODE = {
"afghanistan": "AF",
"albania": "AL",
... # all 199 countries
"zimbabwe": "ZW",
}
Actual result:

API returns 400:

{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "Output blocked by content filtering policy"
},
"request_id": "req_011CYHJuGZhDgweHp9FcpTzq"
}
Expected result:

The output should succeed. This is a standard ISO 3166-1 country list — the same data published by the UN, used in every internationalization library, and present in packages like pycountry, i18n-iso-countries, etc.

Why this is a false positive:

The dictionary contains country names that individually might be associated with sanctions lists or conflict zones (Iran, North Korea, Cuba, Syria, etc.), but in context this is clearly a geographic reference data table, not harmful content. The data is:

Publicly available ISO standard (ISO 3166-1)
Present in thousands of open-source libraries
Required for any application doing internationalization, geographic analysis, or address validation
Workaround:

Generate the dictionary via a Python script that reads the source data from a file and writes it to the target file through file I/O, bypassing the output content filter entirely. The filter only triggers on model-generated output, not on file-to-file data flow.

Impact:

Blocks routine software engineering work. Any task involving country/region reference data (i18n, address forms, geographic dashboards, financial systems) can hit this. The workaround is non-obvious and wastes developer time.

What Should Happen?

Claude Code should be able to output a Python dictionary literal mapping ISO 3166-1 country names to their alpha-2 codes (e.g. {"afghanistan": "AF", "albania": "AL", ... "zimbabwe": "ZW"}). This is standard reference data published by the UN/ISO and present in every i18n library. The output contains no harmful content — it's a lookup table for geographic classification in a financial application.

The ~200-entry dict was blocked mid-generation with a 400 error ("Output blocked by content filtering policy"), likely because the full list includes names of sanctioned/conflict-zone nations (Iran, North Korea, Cuba, Syria, etc.) appearing together. In context, this is clearly a data structure, not harmful content.

Workaround was to generate the dict via a Python script (file I/O bypasses the output filter), but this added unnecessary friction to a routine coding task.

Error Messages/Logs

Steps to Reproduce

Open Claude Code (VS Code extension or CLI)
Have a Python file open that contains a class (e.g. a SQLAlchemy model)
Ask Claude to add a dictionary mapping all ~200 ISO 3166-1 country names to their alpha-2 codes as a class attribute. Example prompt:
"Add a COUNTRY_NAME_TO_CODE dict to this class with all 199 entries from the ISO 3166-1 standard, mapping lowercase country names to their 2-letter codes"

Claude will attempt to output the full dictionary literal via an Edit or Write tool call
The API returns HTTP 400:

{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "Output blocked by content filtering policy"
}
}
Note: The block appears to trigger specifically when many country names (including sanctioned nations like Iran, North Korea, Cuba, Syria, Sudan, etc.) appear together in a single output. Writing smaller subsets of countries succeeds — it's the complete list that triggers the filter.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

see in description

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

VS Code integrated terminal

Additional Information

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗