claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

API Request Failure: Unexpected Usage Policy Violation Error

Open teren-papercutlabs opened this issue 7 months ago • 4 comments

Bug Description I am seeing API Error: Claude Code is unable to respond to this request, which appears to violate our Usage Policy (https://www.anthropic.com/legal/aup). Please double press esc to edit your last message or start a new session for Claude Code to assist with a different task. for messages with no issues whatsoever

Environment Info

  • Platform: linux
  • Terminal: cursor
  • Version: 1.0.31
  • Feedback ID: cf231ac8-8f35-4afc-b777-f4f486719860

Errors

[{"error":"Error: Error opening file /home/teren41/.claude/projects/-home-teren41-environment-weaver-base/d064c16a-ab10-4330-8bd1-dd801804ef65.jsonl: Error: ENOENT: no such file or directory, open '/home/teren41/.claude/projects/-home-teren41-environment-weaver-base/d064c16a-ab10-4330-8bd1-dd801804ef65.jsonl'\n    at c81 (file:///home/teren41/.nvm/versions/node/v22.14.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:574:176)\n    at async ff1 (file:///home/teren41/.nvm/versions/node/v22.14.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:624:2813)\n    at async file:///home/teren41/.nvm/versions/node/v22.14.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:624:3152\n    at async DZ0.appendEntry (file:///home/teren41/.nvm/versions/node/v22.14.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:15)\n    at async DZ0.insertMessageChain (file:///home/teren41/.nvm/versions/node/v22.14.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:622:22680)\n    at async qG1 (file:///home/teren41/.nvm/versions/node/v22.14.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:624:1641)","timestamp":"2025-06-21T11:24:10.134Z"},{"error":"Error: Request was aborted.\n    at Qt._createMessage (file:///home/teren41/.nvm/versions/node/v22.14.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1308:6810)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-06-21T11:25:40.868Z"},{"error":"Error: Error opening file /home/teren41/.claude/projects/-home-teren41-environment-weaver-base/96d5bea8-c5b1-4ec7-93d5-eab2cb17c735.jsonl: Error: ENOENT: no such file or directory, open '/home/teren41/.claude/projects/-home-teren41-environment-weaver-base/96d5bea8-c5b1-4ec7-93d5-eab2cb17c735.jsonl'\n    at c81 (file:///home/teren41/.nvm/versions/node/v22.14.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:574:176)\n    at async ff1 (file:///home/teren41/.nvm/versions/node/v22.14.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:624:2813)\n    at async file:///home/teren41/.nvm/versions/node/v22.14.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:624:3152\n    at async DZ0.appendEntry (file:///home/teren41/.nvm/versions/node/v22.14.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:15)\n    at async DZ0.insertMessageChain (file:///home/teren41/.nvm/versions/node/v22.14.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:622:22680)\n    at async qG1 (file:///home/teren41/.nvm/versions/node/v22.14.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:624:1641)","timestamp":"2025-06-21T11:26:01.736Z"},{"error":"Error: Request was aborted.\n    at Qt._createMessage (file:///home/teren41/.nvm/versions/node/v22.14.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1308:6810)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-06-21T11:36:02.443Z"},{"error":"Error: Request was aborted.\n    at yw.makeRequest (file:///home/teren41/.nvm/versions/node/v22.14.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1317:3784)\n    at processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at runNextTicks (node:internal/process/task_queues:69:3)\n    at process.processTimers (node:internal/timers:526:9)","timestamp":"2025-06-21T11:36:55.073Z"},{"error":"Error: Request was aborted.\n    at yw.makeRequest (file:///home/teren41/.nvm/versions/node/v22.14.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1317:3784)\n    at processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at runNextTicks (node:internal/process/task_queues:69:3)\n    at process.processTimers (node:internal/timers:526:9)","timestamp":"2025-06-21T11:37:33.062Z"},{"error":"Error: Request was aborted.\n    at Qt._createMessage (file:///home/teren41/.nvm/versions/node/v22.14.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1308:6810)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-06-21T11:38:34.091Z"}]

the last few messages:

Let me check the BullMQ imports to see what types are available:

● Bash(grep -r "from "bullmq"" weaver-core/src/domains/task-queue/) ⎿ weaver-core/src/domains/task-queue/services/TaskQueueService.ts:import { Queue, Job , QueueEvents } from "bullmq";

● Let me check if JobsOptions is exported from bullmq and update our config to be properly typed:

● Update(weaver-core/src/domains/task-queue/types/task-queue.types.ts) ⎿ Updated weaver-core/src/domains/task-queue/types/task-queue.types.ts with 1
addition 1 import { Json } from "../../../db/dbtypes"; 2 import { WorkflowCommunicationRequestData } from "../../workflow/types/workf low.types"; 3 + import { JobsOptions } from "bullmq"; 4
5 /** 6 * Defines the valid names for jobs that can be added to the task queue.

● Now let me update the AGENT_QUEUE_CONFIG to be properly typed:

● Update(weaver-core/src/domains/task-queue/types/task-queue.types.ts) ⎿ Updated weaver-core/src/domains/task-queue/types/task-queue.types.ts with 4
additions and 2 removals 74 * Configuration for agent orchestration queue jobs. 75 * Defines retry behavior and retention policies. 76 */ 77 - export const AGENT_QUEUE_CONFIG = { 77 + export const AGENT_QUEUE_CONFIG: { 78 + orchestration: JobsOptions; 79 + } = { 80 orchestration: { 81 attempts: 3, 82 backoff: { 83 - type: 'exponential' as const, 83 + type: 'exponential', 84 delay: 2000 85 }, 86 removeOnComplete: false, // Keep for debugging

● Now let me add the queue name constant to TaskQueueService: ⎿ Interrupted by user

question is how did we configure jobs options for the other queues up til now

● You're right, let me check how the existing queues handle their job options:

● Read(weaver-core/src/domains/task-queue/services/TaskQueueService.ts) ⎿ Read 40 lines (ctrl+r to expand)

● I see! The existing queues use:

  1. A defaultJobOptions object for queue initialization
  2. Override specific options (like jobId, removeOnComplete, removeOnFail) when adding individual jobs

They don't define queue-specific configurations in the types file. The job options are handled inline in the enqueue methods.

Given this pattern, we should follow the same approach. Let me update the AGENT_QUEUE_CONFIG to just be a simple constant that can be spread when needed:

● Update(weaver-core/src/domains/task-queue/types/task-queue.types.ts) ⎿ Updated weaver-core/src/domains/task-queue/types/task-queue.types.ts with 1 remova

   1    import { Json } from "../../../db/dbtypes";
   2    import { WorkflowCommunicationRequestData } from 
 "../../workflow/types/workf
       low.types";
   3 -  import { JobsOptions } from "bullmq";
   3    
   4    /**
   5     * Defines the valid names for jobs that can be added to the task queue.

⎿ API Error: Claude Code is unable to respond to this request, which appears to violate our Usage Policy (https://www.anthropic.com/legal/aup). Please double press esc to edit your last message or start a new session for Claude Code to assist with a different task.

/bug ⎿ Bug report submitted

teren-papercutlabs avatar Jun 21 '25 11:06 teren-papercutlabs

I'm also getting this error.

realm-scott avatar Jun 22 '25 01:06 realm-scott

Im also getting the error. While i didn't mind it in this particular case, basically everything is throwing it right now for me. this was just a silly test that - to me proves something is raising this incorrectly?

Image

at least my issue went away after i closed the session multiple times. i think maybe a node is misconfigured or something, and if youre unlucky and end on it, everything is in violation? pure speculation, obviously.

wohlben avatar Jun 22 '25 04:06 wohlben

I am also getting this error

naren200 avatar Jun 27 '25 01:06 naren200

Me too

cyriljekov avatar Jun 28 '25 22:06 cyriljekov

it becoming annoying.

befr avatar Jul 01 '25 19:07 befr

same here. this happens when the opus main agent dispatches subagents to perform a batch of exploratory ripgrep queries on a directory filled with a bunch of social sciences papers (very vanilla ones, clearly a legitimate use case).

env: macOS 15.5 (24F74) Claude Code 1.0.40 Bun 1.2.17 Nushell 0.105.1 Zed 0.193.3 (alacritty)

oscaromsn avatar Jul 02 '25 03:07 oscaromsn

Yes, it is still happening on my side too.. Have someone any idea about it?

ariburaco avatar Jul 16 '25 09:07 ariburaco

Happening for me right now. Here is my prompt that was flagged as policy violation do we have separate aggregation functions for our different model types?

owquresh avatar Jul 21 '25 01:07 owquresh

hello ⎿ ⧉ Selected 1 lines from ../../../../../../usr/local/bin/claude in Visual Studio Code ⎿ API Error: Claude Code is unable to respond to this request, which appears to violate our Usage Policy (https://www.anthropic.com/legal/aup). Please double press esc to edit your last message or start a new session for Claude Code to assist with a different task.

pvilaboafermata avatar Jul 21 '25 16:07 pvilaboafermata

⎿ API Error: Claude Code is unable to respond to this request, which appears to violate our Usage Policy (https://www.anthropic.com/legal/aup). Please double press esc to edit your last message or start a new session for Claude Code to assist with a different task.

This error is popping up again

jkoch-io avatar Jul 25 '25 14:07 jkoch-io

me too

SIAICAMO avatar Jul 26 '25 15:07 SIAICAMO

Same here. Just sharing screenshots of the app we are coding gives the error. I was perfectly able to use this workflow (sharing screenshots) until yesterday. Now it just won't take them.

alessandro-latenta avatar Aug 07 '25 11:08 alessandro-latenta

I am getting it now - irritating man

agplusman avatar Aug 07 '25 15:08 agplusman

Getting this with Opus4.1 in CC but switch to sonnet and have no issue with it.

All requests are getting this response including things like /init

seantauber avatar Aug 09 '25 02:08 seantauber

I had the same issue! I was able to fix it by running /doctor. When I did so, I noticed that "install config" was "unknown". Even though it was installed via npm.

I started a new terminal chat, had claude sonnet 4 debug itself by detecting its install method and reseting the install config to npm (rather than unknown). It was able to do this all autonomously.

That seems to have fixed the problem for me, hope it helps.

wanderloots avatar Aug 12 '25 20:08 wanderloots

Yes, I get this issue almost every day recently. I'm just coding, zero sensitive information in my chat history.

I can usually resolve this by retry, sometimes I had to restart a new conversation. This is very annoying.

jiangying000 avatar Aug 25 '25 03:08 jiangying000

Same problem

Kuzyashin avatar Aug 28 '25 14:08 Kuzyashin

Here’s what worked for me:

  1. Project folder synced to GitHub
  2. Completely deleted project folder locally
  3. Clone from GitHub into new folder

Problem was solved after this.

On Thu, Aug 28, 2025 at 7:49 AM Alexey Kuzyashin @.***> wrote:

Kuzyashin left a comment (anthropics/claude-code#2410) https://github.com/anthropics/claude-code/issues/2410#issuecomment-3233813675

Same problem

— Reply to this email directly, view it on GitHub https://github.com/anthropics/claude-code/issues/2410#issuecomment-3233813675, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAP2D5RDL4MXDRUKV7DIGOT3P4JIXAVCNFSM6AAAAAB72BAAUCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTEMZTHAYTGNRXGU . You are receiving this because you commented.Message ID: @.***>

seantauber avatar Aug 28 '25 15:08 seantauber

I can't re-do everything. I just said hello and got that warning. Restarted claude, managed to say hello, showed it an image, it worked, then just said: what do you think... and bam, again. Surely I'm not violating policies?

Andres75 avatar Oct 01 '25 08:10 Andres75

I wonder if there is some kind of system prompt A/B testing experiment that a few of us ended up on the wrong side of (combined with Sonnet 4.5's stricter filter).

In the system prompt my Claude Code installation is using, I see two sections with a lot of scary words in them:

IMPORTANT: Assist with authorized security testing, defensive security, CTF challenges, and educational contexts. Refuse requests for destructive techniques, DoS attacks, mass targeting, supply chain compromise, or detection evasion for malicious purposes. Dual-use security tools (C2 frameworks, credential testing, exploit development) require clear authorization context: pentesting engagements, CTF competitions, security research, or defensive use cases.

and

- Be careful not to introduce security vulnerabilities such as command injection, XSS, SQL injection, and other OWASP top 10 vulnerabilities. If you notice that you wrote insecure code, immediately fix it.

I could definitely see these causing false positives depending on what (probably much simpler/faster/cheaper) model they're using to flag usage policy violations.

Sometimes I'm getting flagged even when my prompt is just "rename this variable from foo to bar" in a basic web app.

emernic avatar Nov 03 '25 22:11 emernic

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] avatar Dec 09 '25 10:12 github-actions[bot]