Excessive Token Consumption and Prolonged Processing in New Sessions

Resolved 💬 4 comments Opened Jul 17, 2025 by ashwin-shopify Closed Jan 5, 2026

Bug Description
When starting a new session (even after I issue /clear), claude goes immediately to "compacting conversation". Last night, I started a new session and issued a simple prompt. It was running for over 2 hours. I let it run as long as it wanted to see how long it would take on a new session and it ran for almost 5 hours answering just one prompt.
It seems to have used wayy more tokens than it should have. I asked others to try the same and they got the answer almost immediately with far less token usage.

Environment Info

  • Platform: darwin
  • Terminal: iTerm.app
  • Version: 1.0.43
  • Feedback ID:

Errors

[{"error":"Error: Command failed: security find-generic-password -a $USER -w -s \"Claude Code\"\nsecurity: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.\n\n    at genericNodeError (node:internal/errors:984:15)\n    at wrappedFn (node:internal/errors:538:14)\n    at checkExecSyncError (node:child_process:891:11)\n    at execSync (node:child_process:963:15)\n    at ED (file:///nix/store/q8klnhzigbxibbzjk1hahw1g1migdldf-claude-code-1.0.43/lib/node_modules/@anthropic-ai/claude-code/cli.js:702:3921)\n    at file:///nix/store/q8klnhzigbxibbzjk1hahw1g1migdldf-claude-code-1.0.43/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:9038\n    at Q (file:///nix/store/q8klnhzigbxibbzjk1hahw1g1migdldf-claude-code-1.0.43/lib/node_modules/@anthropic-ai/claude-code/cli.js:526:13327)\n    at Rh2 (file:///nix/store/q8klnhzigbxibbzjk1hahw1g1migdldf-claude-code-1.0.43/lib/node_modules/@anthropic-ai/claude-code/cli.js:2550:6913)\n    at Ew (file:///nix/store/q8klnhzigbxibbzjk1hahw1g1migdldf-claude-code-1.0.43/lib/node_modules/@anthropic-ai/claude-code/cli.js:65:19798)\n    at jP (file:///nix/store/q8klnhzigbxibbzjk1hahw1g1migdldf-claude-code-1.0.43/lib/node_modules/@anthropic-ai/claude-code/cli.js:67:42569)","timestamp":"2025-07-17T13:34:17.702Z"},{"error":"RangeError [ERR_CHILD_PROCESS_STDIO_MAXBUFFER]: stdout maxBuffer length exceeded\n    at Socket.onChildStdout (node:child_process:490:14)\n    at Socket.emit (node:events:524:28)\n    at Socket.emit (node:domain:489:12)\n    at addChunk (node:internal/streams/readable:561:12)\n    at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)\n    at Readable.push (node:internal/streams/readable:392:5)\n    at Pipe.onStreamRead (node:internal/stream_base_commons:191:23)","timestamp":"2025-07-17T13:34:17.903Z"},{"error":"AxiosError: Request failed with status code 401\n    at kH (file:///nix/store/q8klnhzigbxibbzjk1hahw1g1migdldf-claude-code-1.0.43/lib/node_modules/@anthropic-ai/claude-code/cli.js:528:1070)\n    at IncomingMessage.HA (file:///nix/store/q8klnhzigbxibbzjk1hahw1g1migdldf-claude-code-1.0.43/lib/node_modules/@anthropic-ai/claude-code/cli.js:529:9956)\n    at IncomingMessage.emit (node:events:536:35)\n    at IncomingMessage.emit (node:domain:489:12)\n    at endReadableNT (node:internal/streams/readable:1698:12)\n    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)\n    at vi.request (file:///nix/store/q8klnhzigbxibbzjk1hahw1g1migdldf-claude-code-1.0.43/lib/node_modules/@anthropic-ai/claude-code/cli.js:531:2081)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async zi1.doExport (file:///nix/store/q8klnhzigbxibbzjk1hahw1g1migdldf-claude-code-1.0.43/lib/node_modules/@anthropic-ai/claude-code/cli.js:721:29262)","timestamp":"2025-07-17T13:39:17.345Z"},{"error":"Error: {\"stack\":\"Error: PeriodicExportingMetricReader: metrics export failed (error AxiosError: Request failed with status code 401)\\n    at gx0._doRun (file:///nix/store/q8klnhzigbxibbzjk1hahw1g1migdldf-claude-code-1.0.43/lib/node_modules/@anthropic-ai/claude-code/cli.js:279:154325)\\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\\n    at async gx0._runOnce (file:///nix/store/q8klnhzigbxibbzjk1hahw1g1migdldf-claude-code-1.0.43/lib/node_modules/@anthropic-ai/claude-code/cli.js:279:153577)\",\"message\":\"PeriodicExportingMetricReader: metrics export failed (error AxiosError: Request failed with status code 401)\",\"name\":\"Error\"}\n    at Hi1.error (file:///nix/store/q8klnhzigbxibbzjk1hahw1g1migdldf-claude-code-1.0.43/lib/node_modules/@anthropic-ai/claude-code/cli.js:721:27265)\n    at yu1.error (file:///nix/store/q8klnhzigbxibbzjk1hahw1g1migdldf-claude-code-1.0.43/lib/node_modules/@anthropic-ai/claude-code/cli.js:279:14930)\n    at file:///nix/store/q8klnhzigbxibbzjk1hahw1g1migdldf-claude-code-1.0.43/lib/node_modules/@anthropic-ai/claude-code/cli.js:279:63772\n    at Object.g3Q (file:///nix/store/q8klnhzigbxibbzjk1hahw1g1migdldf-claude-code-1.0.43/lib/node_modules/@anthropic-ai/claude-code/cli.js:279:64314)\n    at gx0._runOnce (file:///nix/store/q8klnhzigbxibbzjk1hahw1g1migdldf-claude-code-1.0.43/lib/node_modules/@anthropic-ai/claude-code/cli.js:279:153784)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)","timestamp":"2025-07-17T13:39:17.347Z"},{"error":"AxiosError: Request failed with status code 401\n    at kH (file:///nix/store/q8klnhzigbxibbzjk1hahw1g1migdldf-claude-code-1.0.43/lib/node_modules/@anthropic-a

Note: Error logs were truncated.

View original on GitHub ↗

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