claude-code - 💡(How to fix) Fix [Bug] Anthropic API Error: ECONNRESET - Connection Reset During Session [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#52414Fetched 2026-04-24 06:07:48
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Author
Timeline (top)
labeled ×5commented ×1

Error Message

[{"error":"Error: Error normalizing tool input: ZodError: [\n {\n "code": "unrecognized_keys",\n "keys": [\n "new_string"\n ],\n "path": [],\n "message": "Unrecognized key: \"new_string\""\n }\n]\n at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:5020:1010)\n at map (native:1:11)\n at K3_ (/$bunfs/root/src/entrypoints/cli.js:5020:556)\n at Tr7 (/$bunfs/root/src/entrypoints/cli.js:8085:8874)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-21T14:44:52.050Z"},{"error":"Error: 429 {"type":"error","error":{"type":"rate_limit_error","message":"This request would exceed your account's rate limit. Please try again later."},"request_id":"req_011CaHHT41FETT5MSd38E7fq"}\n at generate (/$bunfs/root/src/entrypoints/cli.js:11:54296)\n at makeRequest (/$bunfs/root/src/entrypoints/cli.js:50:4943)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-21T17:08:20.289Z"},{"error":"Error: File does not exist. Note: your current working directory is /Users/matthewfowkes/ClaudeCode/FoundRevenueApp. Did you mean knexfile.ts?\n at call (/$bunfs/root/src/entrypoints/cli.js:4741:7630)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-21T20:43:32.399Z"},{"error":"Error: Request was aborted.\n at makeRequest (/$bunfs/root/src/entrypoints/cli.js:50:3448)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-21T21:16:58.719Z"},{"error":"MaxFileReadTokenExceededError: File content (54337 tokens) exceeds maximum allowed tokens (25000). Use offset and limit parameters to read specific portions of the file, or search for specific content instead of reading the whole file.\n at X27 (/$bunfs/root/src/entrypoints/cli.js:4732:12656)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-22T18:48:05.821Z"},{"error":"AxiosError: timeout of 5000ms exceeded\n at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:115:13307)\n at emit (node:events:92:22)\n at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:114:3321)\n at request (/$bunfs/root/src/entrypoints/cli.js:117:2467)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-22T19:02:12.695Z"},{"error":"Error: ensureToolResultPairing: repaired missing tool_result blocks (494 -> 494 messages). Message structure: [0] user; [1] user; [2] assistant(id=msg_01B7BGL5wfG4LFyaLX8kF9nr, tool_uses=[toolu_01FL63t4YQAHNYMv5Y5hmzUu]); [3] user(tool_results=[toolu_01FL63t4YQAHNYMv5Y5hmzUu]); [4] assistant(id=msg_01UJ1E49eyZnWMXKGCa8mwTa, tool_uses=[toolu_01N2JPfgwgend2cb8Ye5knQJ]); [5] user(tool_results=[toolu_01N2JPfgwgend2cb8Ye5knQJ]); [6] assistant(id=msg_014jh1ZoAPDx1gmTNZsREe8i, tool_uses=[toolu_014HgDWZW9m4w39rxgXs2Xnu]); [7] user(tool_results=[toolu_014HgDWZW9m4w39rxgXs2Xnu]); [8] assistant(id=msg_01RQpJSeaKgLVeNXZKEoYnK5, tool_uses=[toolu_016th4kLm4Bw71hBkSQAXVgc]); [9] user(tool_results=[toolu_016th4kLm4Bw71hBkSQAXVgc]); [10] assistant(id=msg_01EFCxZR3eBQx6WvM4xe1KD7, tool_uses=[toolu_01LK5Sc5mA8RYH4F6nyKH4DK]); [11] user(tool_results=[toolu_01LK5Sc5mA8RYH4F6nyKH4DK]); [12] assistant(id=msg_011CJkZfABbDc8CtEbrs6KqP, tool_uses=[toolu_017qLZet18Qe7kn2XhBVB3CK]); [13] user(tool_results=[toolu_017qLZet18Qe7kn2XhBVB3CK]); [14] assistant(id=msg_01MEBaX8CPr3atvMkKT3d1Tv, tool_uses=[toolu_01TNDgYWWGPG8UsPGDJGdE1d]); [15] user(tool_results=[toolu_01TNDgYWWGPG8UsPGDJGdE1d]); [16] assistant(id=msg_019EBCxPbux6Me12dE2T7N22, tool_uses=[toolu_01YXbPtLwT1HmyycaGKfyTfN]); [17] user(tool_results=[toolu_01YXbPtLwT1HmyycaGKfyTfN]); [18] assistant(id=msg_01YWcbzsPk6QMVTmXSrFMjWP, tool_uses=[toolu_01AB1oZxZbHMs3YiaYS8MQFH]); [19] user(tool_results=[toolu_01AB1oZxZbHMs3YiaYS8MQFH]); [20] assistant(id=msg_015LzxXMmVS1U4vGUTn11UKT, tool_uses=[toolu_019CVQgo6mWTrwt7gTGo9hV9]); [21] user(tool_results=[toolu_019CVQgo6mWTrwt7gTGo9hV9]); [22] assistant(id=msg_01KCswECViVczvKobZn6tY4x, tool_uses=[toolu_01Jwfh2wqtrwhfnhGUiyUczK]); [23] user(tool_results=[toolu_01Jwfh2wqtrwhfnhGUiyUczK]); [24] assistant(id=msg_011uinTYJFSrCJ6AzN7b4QEE, tool_uses=[toolu_01MjvHVDWWrdKT9uaRoK5vv6]); [25] user(tool_results=[toolu_01MjvHVDWWrdKT9uaRoK5vv6]); [26] assistant(id=msg_016GXMki1V12J1efHFrH2bXD, tool_uses=[toolu_01HLYTnYuqUEJzPe8vt8HoEG]); [27] user(tool_results=[toolu_01HLYTnYuqUEJzPe8vt8HoEG]); [28] assistant(id=msg_014RsGGfqjW8AiH6DaqceTGq, tool_uses=[toolu_01LYxg8e71MEqYsLMZfu7bcr]); [29] user(tool_results=[toolu_01LYxg8e71MEqYsLMZfu7bcr]); [30] assistant(id=msg_01BiHUhEuZpFbjNSh8F5EtDW, tool_uses=[toolu_01VnhxSXwExE4BpJY3JHN2ig]); [31] user(tool_results=[toolu_01VnhxSXwExE4BpJY3JHN2ig]); [32] assistant(id=msg_019DRNUVjLQQhFPCVTQqLuFR, tool_uses=[toolu_01Kqdu2JZnDydmyKNteZUBPa]); [33]…

Code Example

[{"error":"Error: Error normalizing tool input: ZodError: [\n  {\n    \"code\": \"unrecognized_keys\",\n    \"keys\": [\n      \"new_string\"\n    ],\n    \"path\": [],\n    \"message\": \"Unrecognized key: \\\"new_string\\\"\"\n  }\n]\n    at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:5020:1010)\n    at map (native:1:11)\n    at K3_ (/$bunfs/root/src/entrypoints/cli.js:5020:556)\n    at Tr7 (/$bunfs/root/src/entrypoints/cli.js:8085:8874)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-21T14:44:52.050Z"},{"error":"Error: 429 {\"type\":\"error\",\"error\":{\"type\":\"rate_limit_error\",\"message\":\"This request would exceed your account's rate limit. Please try again later.\"},\"request_id\":\"req_011CaHHT41FETT5MSd38E7fq\"}\n    at generate (/$bunfs/root/src/entrypoints/cli.js:11:54296)\n    at makeRequest (/$bunfs/root/src/entrypoints/cli.js:50:4943)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-21T17:08:20.289Z"},{"error":"Error: File does not exist. Note: your current working directory is /Users/matthewfowkes/ClaudeCode/FoundRevenueApp. Did you mean knexfile.ts?\n    at call (/$bunfs/root/src/entrypoints/cli.js:4741:7630)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-21T20:43:32.399Z"},{"error":"Error: Request was aborted.\n    at makeRequest (/$bunfs/root/src/entrypoints/cli.js:50:3448)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-21T21:16:58.719Z"},{"error":"MaxFileReadTokenExceededError: File content (54337 tokens) exceeds maximum allowed tokens (25000). Use offset and limit parameters to read specific portions of the file, or search for specific content instead of reading the whole file.\n    at X27 (/$bunfs/root/src/entrypoints/cli.js:4732:12656)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-22T18:48:05.821Z"},{"error":"AxiosError: timeout of 5000ms exceeded\n    at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:115:13307)\n    at emit (node:events:92:22)\n    at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:114:3321)\n    at request (/$bunfs/root/src/entrypoints/cli.js:117:2467)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-22T19:02:12.695Z"},{"error":"Error: ensureToolResultPairing: repaired missing tool_result blocks (494 -> 494 messages). Message structure: [0] user; [1] user; [2] assistant(id=msg_01B7BGL5wfG4LFyaLX8kF9nr, tool_uses=[toolu_01FL63t4YQAHNYMv5Y5hmzUu]); [3] user(tool_results=[toolu_01FL63t4YQAHNYMv5Y5hmzUu]); [4] assistant(id=msg_01UJ1E49eyZnWMXKGCa8mwTa, tool_uses=[toolu_01N2JPfgwgend2cb8Ye5knQJ]); [5] user(tool_results=[toolu_01N2JPfgwgend2cb8Ye5knQJ]); [6] assistant(id=msg_014jh1ZoAPDx1gmTNZsREe8i, tool_uses=[toolu_014HgDWZW9m4w39rxgXs2Xnu]); [7] user(tool_results=[toolu_014HgDWZW9m4w39rxgXs2Xnu]); [8] assistant(id=msg_01RQpJSeaKgLVeNXZKEoYnK5, tool_uses=[toolu_016th4kLm4Bw71hBkSQAXVgc]); [9] user(tool_results=[toolu_016th4kLm4Bw71hBkSQAXVgc]); [10] assistant(id=msg_01EFCxZR3eBQx6WvM4xe1KD7, tool_uses=[toolu_01LK5Sc5mA8RYH4F6nyKH4DK]); [11] user(tool_results=[toolu_01LK5Sc5mA8RYH4F6nyKH4DK]); [12] assistant(id=msg_011CJkZfABbDc8CtEbrs6KqP, tool_uses=[toolu_017qLZet18Qe7kn2XhBVB3CK]); [13] user(tool_results=[toolu_017qLZet18Qe7kn2XhBVB3CK]); [14] assistant(id=msg_01MEBaX8CPr3atvMkKT3d1Tv, tool_uses=[toolu_01TNDgYWWGPG8UsPGDJGdE1d]); [15] user(tool_results=[toolu_01TNDgYWWGPG8UsPGDJGdE1d]); [16] assistant(id=msg_019EBCxPbux6Me12dE2T7N22, tool_uses=[toolu_01YXbPtLwT1HmyycaGKfyTfN]); [17] user(tool_results=[toolu_01YXbPtLwT1HmyycaGKfyTfN]); [18] assistant(id=msg_01YWcbzsPk6QMVTmXSrFMjWP, tool_uses=[toolu_01AB1oZxZbHMs3YiaYS8MQFH]); [19] user(tool_results=[toolu_01AB1oZxZbHMs3YiaYS8MQFH]); [20] assistant(id=msg_015LzxXMmVS1U4vGUTn11UKT, tool_uses=[toolu_019CVQgo6mWTrwt7gTGo9hV9]); [21] user(tool_results=[toolu_019CVQgo6mWTrwt7gTGo9hV9]); [22] assistant(id=msg_01KCswECViVczvKobZn6tY4x, tool_uses=[toolu_01Jwfh2wqtrwhfnhGUiyUczK]); [23] user(tool_results=[toolu_01Jwfh2wqtrwhfnhGUiyUczK]); [24] assistant(id=msg_011uinTYJFSrCJ6AzN7b4QEE, tool_uses=[toolu_01MjvHVDWWrdKT9uaRoK5vv6]); [25] user(tool_results=[toolu_01MjvHVDWWrdKT9uaRoK5vv6]); [26] assistant(id=msg_016GXMki1V12J1efHFrH2bXD, tool_uses=[toolu_01HLYTnYuqUEJzPe8vt8HoEG]); [27] user(tool_results=[toolu_01HLYTnYuqUEJzPe8vt8HoEG]); [28] assistant(id=msg_014RsGGfqjW8AiH6DaqceTGq, tool_uses=[toolu_01LYxg8e71MEqYsLMZfu7bcr]); [29] user(tool_results=[toolu_01LYxg8e71MEqYsLMZfu7bcr]); [30] assistant(id=msg_01BiHUhEuZpFbjNSh8F5EtDW, tool_uses=[toolu_01VnhxSXwExE4BpJY3JHN2ig]); [31] user(tool_results=[toolu_01VnhxSXwExE4BpJY3JHN2ig]); [32] assistant(id=msg_019DRNUVjLQQhFPCVTQqLuFR, tool_uses=[toolu_01Kqdu2JZnDydmyKNteZUBPa]); [33]
RAW_BUFFERClick to expand / collapse

Bug Description i keep getting API Error: Unable to connect to API (ECONNRESET) only in this session all of my other sessions are fine

Environment Info

  • Platform: darwin
  • Terminal: Apple_Terminal
  • Version: 2.1.116
  • Feedback ID: 4f6c9c8f-49db-498f-a48e-1bd4b49d4b7c

Errors

[{"error":"Error: Error normalizing tool input: ZodError: [\n  {\n    \"code\": \"unrecognized_keys\",\n    \"keys\": [\n      \"new_string\"\n    ],\n    \"path\": [],\n    \"message\": \"Unrecognized key: \\\"new_string\\\"\"\n  }\n]\n    at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:5020:1010)\n    at map (native:1:11)\n    at K3_ (/$bunfs/root/src/entrypoints/cli.js:5020:556)\n    at Tr7 (/$bunfs/root/src/entrypoints/cli.js:8085:8874)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-21T14:44:52.050Z"},{"error":"Error: 429 {\"type\":\"error\",\"error\":{\"type\":\"rate_limit_error\",\"message\":\"This request would exceed your account's rate limit. Please try again later.\"},\"request_id\":\"req_011CaHHT41FETT5MSd38E7fq\"}\n    at generate (/$bunfs/root/src/entrypoints/cli.js:11:54296)\n    at makeRequest (/$bunfs/root/src/entrypoints/cli.js:50:4943)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-21T17:08:20.289Z"},{"error":"Error: File does not exist. Note: your current working directory is /Users/matthewfowkes/ClaudeCode/FoundRevenueApp. Did you mean knexfile.ts?\n    at call (/$bunfs/root/src/entrypoints/cli.js:4741:7630)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-21T20:43:32.399Z"},{"error":"Error: Request was aborted.\n    at makeRequest (/$bunfs/root/src/entrypoints/cli.js:50:3448)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-21T21:16:58.719Z"},{"error":"MaxFileReadTokenExceededError: File content (54337 tokens) exceeds maximum allowed tokens (25000). Use offset and limit parameters to read specific portions of the file, or search for specific content instead of reading the whole file.\n    at X27 (/$bunfs/root/src/entrypoints/cli.js:4732:12656)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-22T18:48:05.821Z"},{"error":"AxiosError: timeout of 5000ms exceeded\n    at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:115:13307)\n    at emit (node:events:92:22)\n    at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:114:3321)\n    at request (/$bunfs/root/src/entrypoints/cli.js:117:2467)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-22T19:02:12.695Z"},{"error":"Error: ensureToolResultPairing: repaired missing tool_result blocks (494 -> 494 messages). Message structure: [0] user; [1] user; [2] assistant(id=msg_01B7BGL5wfG4LFyaLX8kF9nr, tool_uses=[toolu_01FL63t4YQAHNYMv5Y5hmzUu]); [3] user(tool_results=[toolu_01FL63t4YQAHNYMv5Y5hmzUu]); [4] assistant(id=msg_01UJ1E49eyZnWMXKGCa8mwTa, tool_uses=[toolu_01N2JPfgwgend2cb8Ye5knQJ]); [5] user(tool_results=[toolu_01N2JPfgwgend2cb8Ye5knQJ]); [6] assistant(id=msg_014jh1ZoAPDx1gmTNZsREe8i, tool_uses=[toolu_014HgDWZW9m4w39rxgXs2Xnu]); [7] user(tool_results=[toolu_014HgDWZW9m4w39rxgXs2Xnu]); [8] assistant(id=msg_01RQpJSeaKgLVeNXZKEoYnK5, tool_uses=[toolu_016th4kLm4Bw71hBkSQAXVgc]); [9] user(tool_results=[toolu_016th4kLm4Bw71hBkSQAXVgc]); [10] assistant(id=msg_01EFCxZR3eBQx6WvM4xe1KD7, tool_uses=[toolu_01LK5Sc5mA8RYH4F6nyKH4DK]); [11] user(tool_results=[toolu_01LK5Sc5mA8RYH4F6nyKH4DK]); [12] assistant(id=msg_011CJkZfABbDc8CtEbrs6KqP, tool_uses=[toolu_017qLZet18Qe7kn2XhBVB3CK]); [13] user(tool_results=[toolu_017qLZet18Qe7kn2XhBVB3CK]); [14] assistant(id=msg_01MEBaX8CPr3atvMkKT3d1Tv, tool_uses=[toolu_01TNDgYWWGPG8UsPGDJGdE1d]); [15] user(tool_results=[toolu_01TNDgYWWGPG8UsPGDJGdE1d]); [16] assistant(id=msg_019EBCxPbux6Me12dE2T7N22, tool_uses=[toolu_01YXbPtLwT1HmyycaGKfyTfN]); [17] user(tool_results=[toolu_01YXbPtLwT1HmyycaGKfyTfN]); [18] assistant(id=msg_01YWcbzsPk6QMVTmXSrFMjWP, tool_uses=[toolu_01AB1oZxZbHMs3YiaYS8MQFH]); [19] user(tool_results=[toolu_01AB1oZxZbHMs3YiaYS8MQFH]); [20] assistant(id=msg_015LzxXMmVS1U4vGUTn11UKT, tool_uses=[toolu_019CVQgo6mWTrwt7gTGo9hV9]); [21] user(tool_results=[toolu_019CVQgo6mWTrwt7gTGo9hV9]); [22] assistant(id=msg_01KCswECViVczvKobZn6tY4x, tool_uses=[toolu_01Jwfh2wqtrwhfnhGUiyUczK]); [23] user(tool_results=[toolu_01Jwfh2wqtrwhfnhGUiyUczK]); [24] assistant(id=msg_011uinTYJFSrCJ6AzN7b4QEE, tool_uses=[toolu_01MjvHVDWWrdKT9uaRoK5vv6]); [25] user(tool_results=[toolu_01MjvHVDWWrdKT9uaRoK5vv6]); [26] assistant(id=msg_016GXMki1V12J1efHFrH2bXD, tool_uses=[toolu_01HLYTnYuqUEJzPe8vt8HoEG]); [27] user(tool_results=[toolu_01HLYTnYuqUEJzPe8vt8HoEG]); [28] assistant(id=msg_014RsGGfqjW8AiH6DaqceTGq, tool_uses=[toolu_01LYxg8e71MEqYsLMZfu7bcr]); [29] user(tool_results=[toolu_01LYxg8e71MEqYsLMZfu7bcr]); [30] assistant(id=msg_01BiHUhEuZpFbjNSh8F5EtDW, tool_uses=[toolu_01VnhxSXwExE4BpJY3JHN2ig]); [31] user(tool_results=[toolu_01VnhxSXwExE4BpJY3JHN2ig]); [32] assistant(id=msg_019DRNUVjLQQhFPCVTQqLuFR, tool_uses=[toolu_01Kqdu2JZnDydmyKNteZUBPa]); [33]

Note: Content was truncated.

extent analysis

TL;DR

The issue is likely caused by exceeding the rate limit or connection timeouts, and a workaround could be to implement retry logic with exponential backoff or increase the timeout duration.

Guidance

  • Review the error messages to identify the specific cause of the issue, such as rate limiting or connection timeouts.
  • Consider implementing retry logic with exponential backoff to handle temporary connection issues.
  • Increase the timeout duration to allow for longer connections.
  • Verify that the API endpoint is correctly configured and accessible.

Example

// Example of retry logic with exponential backoff
const axios = require('axios');

const retry = async (fn, retries = 3, delay = 500) => {
  try {
    return await fn();
  } catch (error) {
    if (retries > 0) {
      await new Promise(resolve => setTimeout(resolve, delay));
      return retry(fn, retries - 1, delay * 2);
    } else {
      throw error;
    }
  }
};

const makeRequest = async () => {
  return axios.get('https://example.com/api/endpoint');
};

retry(makeRequest).then(response => {
  console.log(response.data);
}).catch(error => {
  console.error(error);
});

Notes

The provided error messages suggest that the issue is related to rate limiting or connection timeouts. However, without more information about the API endpoint and the code making the requests, it's difficult to provide a more specific solution.

Recommendation

Apply a workaround by implementing retry logic with exponential backoff to handle temporary connection issues. This can help mitigate the effects of rate limiting and connection timeouts.

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