Title: Unexpected Code Edit Failure with Promise Rejection Error

Resolved 💬 4 comments Opened Jun 20, 2025 by viaSeunghyun Closed Jan 5, 2026

Bug Description
When edit some file, claude code shutdown and print "String not found in file. Failed to apply edit." where "internal/process/promises:394"

Environment Info

  • Platform: darwin
  • Terminal: goland
  • Version: 1.0.30
  • Feedback ID: 4bfd82de-be39-4974-8f50-44594ae066b9

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:983:15)\n    at wrappedFn (node:internal/errors:537:14)\n    at checkExecSyncError (node:child_process:882:11)\n    at execSync (node:child_process:954:15)\n    at NZ (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:699:3921)\n    at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:622:9014\n    at Q (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:526:17199)\n    at QX (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:622:8160)\n    at kS (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:622:7241)\n    at L9 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:622:11408)","timestamp":"2025-06-20T04:28:36.513Z"}]

Final Exception Log

node:internal/process/promises:394
    triggerUncaughtException(err, true /* fromPromise */);
    ^

Error: String not found in file. Failed to apply edit.
    at gO (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1602:546)
    at HF5 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1916:11500)
    at F (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1916:10478)
    at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1916:10744
    at GI (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:21374)
    at XY (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:40861)
    at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:39057
    at TP1 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:76:79278)
    at Immediate.NP1 [as _onImmediate] (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:76:79696)
    at process.processImmediate (node:internal/timers:505:21)

Node.js v23.11.0

View original on GitHub ↗

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