claude-code - 💡(How to fix) Fix [Bug] Anthropic API Error: Usage Policy rejection on valid requests [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#56095Fetched 2026-05-05 05:58:21
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Author
Timeline (top)
labeled ×3commented ×1

Error Message

API Error: Claude Code is unable to respond to this request, which appears to violate our Usage Policy. This request triggered cyber-related safeguards...

Fix Action

Fix / Workaround

The session used xmir-patcher — the standard community tool for unlocking Xiaomi routers, widely referenced in OpenWRT forums. After all built-in exploits failed (the device is on a patched firmware), the classifier triggered on a grep over the tool's source code looking for the API login function. No exploit development was happening — just reading existing OSS code to understand how the tool authenticates.

  • Target device is my own consumer router
  • xmir-patcher is a public OSS project (github.com/openwrt-xiaomi/xmir-patcher) referenced in official OpenWRT wiki/forum threads for this device family
  • The blocked action was reading source code, not writing exploit logic
  • Earlier in the same session, running the tool's existing exploits was permitted — only the source-reading step got flagged

Code Example

grep -n "web_login\|def web_login\|def get_stok\|stok\|API/" gateway.py

---

API Error: Claude Code is unable to respond to this request, which appears
to violate our Usage Policy. This request triggered cyber-related safeguards...
RAW_BUFFERClick to expand / collapse

Bug Description

False positive on cyber-safeguards classifier during a legitimate homelab task: installing OpenWRT on my own router (Xiaomi AX3000T, RD03v2 hardware revision).

The session used xmir-patcher — the standard community tool for unlocking Xiaomi routers, widely referenced in OpenWRT forums. After all built-in exploits failed (the device is on a patched firmware), the classifier triggered on a grep over the tool's source code looking for the API login function. No exploit development was happening — just reading existing OSS code to understand how the tool authenticates.

Environment

  • Platform: Linux (EndeavourOS)
  • Terminal: Konsole
  • Claude Code: 2.1.119
  • Feedback ID: bad6b1dd-c835-4066-9f6c-96e559831839

Repro context

Trigger command:

grep -n "web_login\|def web_login\|def get_stok\|stok\|API/" gateway.py

Response:

API Error: Claude Code is unable to respond to this request, which appears
to violate our Usage Policy. This request triggered cyber-related safeguards...

Why I think this is a false positive

  • Target device is my own consumer router
  • xmir-patcher is a public OSS project (github.com/openwrt-xiaomi/xmir-patcher) referenced in official OpenWRT wiki/forum threads for this device family
  • The blocked action was reading source code, not writing exploit logic
  • Earlier in the same session, running the tool's existing exploits was permitted — only the source-reading step got flagged

Suggested fix

Lower sensitivity when the surrounding session context is clearly homelab/router-flashing (mentions of OpenWRT, MiWiFi, known device model strings, public OSS tooling).

extent analysis

TL;DR

Adjust the cyber-safeguards classifier to consider session context, specifically for homelab and router-flashing activities, to reduce false positives.

Guidance

  • Review the classifier's logic to identify the specific trigger for the false positive, focusing on the grep command and the xmir-patcher tool's source code.
  • Consider implementing a whitelist for public OSS projects like xmir-patcher to prevent similar false positives in the future.
  • Evaluate the feasibility of incorporating session context, such as mentions of OpenWRT, MiWiFi, or known device model strings, to adjust the classifier's sensitivity.
  • Investigate the possibility of adding an exemption for reading existing OSS code, distinguishing it from exploit development activities.

Example

No code snippet is provided as it is not clearly supported by the issue.

Notes

The suggested fix relies on the assumption that the classifier can be adjusted to consider session context and whitelist public OSS projects. The effectiveness of this approach may vary depending on the classifier's implementation and the specific use cases.

Recommendation

Apply a workaround by adjusting the classifier's sensitivity for homelab and router-flashing activities, as this approach is more feasible given the current information.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [Bug] Anthropic API Error: Usage Policy rejection on valid requests [1 comments, 2 participants]