[Bug] Shell commands incorrectly prefixed with `cd` to current directory, breaking command whitelisting

Resolved 💬 3 comments Opened Mar 19, 2026 by eproxus Closed May 18, 2026

Bug Description
Claude Code keeps prefixing almost all shell commands with a cd into the current directory. This makes the command whitelisting impossible to apply (because it is about cd and not the actual command).

Environment Info

  • Platform: darwin
  • Terminal: ghostty
  • Version: 2.1.76
  • Feedback ID: ea75b37b-27d7-46a4-9676-afd95f2ece5b

Errors

[{"error":"Error: ensureToolResultPairing: repaired missing tool_result blocks (667 -> 667 messages). Message structure: [0] user; [1] assistant(id=msg_01LBkYCKtpVcmUxcNEMiqQ7Y, tool_uses=[toolu_01RyRiT3igqybAGTJhVhHJj3,toolu_01EC2gssD3VAv9kJVbKdchsu,toolu_01GWc66FJ88Z5ogCaPjYfihE,toolu_01FYo8GKHhZu6dzF97hAHhAP,toolu_01Nyp372ej8Jn5a9w6z3BNfv]); [2] user(tool_results=[toolu_01RyRiT3igqybAGTJhVhHJj3,toolu_01EC2gssD3VAv9kJVbKdchsu,toolu_01GWc66FJ88Z5ogCaPjYfihE,toolu_01FYo8GKHhZu6dzF97hAHhAP,toolu_01Nyp372ej8Jn5a9w6z3BNfv]); [3] assistant(id=msg_012eTj42yH7QnL1XJJSqvPkA, tool_uses=[toolu_01JaTf1fp5SAoogQ9cKxCQXY]); [4] user(tool_results=[toolu_01JaTf1fp5SAoogQ9cKxCQXY]); [5] assistant(id=msg_01H2FAx2cvLZnHt8NEG3exD2, tool_uses=[toolu_013FTGNviM49sAkbMvzPSSwf]); [6] user(tool_results=[toolu_013FTGNviM49sAkbMvzPSSwf]); [7] assistant(id=msg_01VFDYYvStdmfEtG3sxjZZE2, tool_uses=[toolu_012WDDchNRSZp6pFqZyZbgWP]); [8] user(tool_results=[toolu_012WDDchNRSZp6pFqZyZbgWP]); [9] assistant(id=msg_01UWBExnewa6KPnBKji9TevR, tool_uses=[toolu_0166gz5KyY3pmxShstYLRCtR]); [10] user(tool_results=[toolu_0166gz5KyY3pmxShstYLRCtR]); [11] assistant(id=msg_01CDX6TcgKdKoPJGjcNu12ut, tool_uses=[toolu_016TxwfUJwC8LipSfUYQacuu]); [12] user(tool_results=[toolu_016TxwfUJwC8LipSfUYQacuu]); [13] assistant(id=msg_01XrUxry7LoGi6nd5T8bSY8R, tool_uses=[toolu_01WtRoLkFZxcWJrBf3iDezvg]); [14] user(tool_results=[toolu_01WtRoLkFZxcWJrBf3iDezvg]); [15] assistant(id=msg_01HBmEY2Rv3NeQyY3HK3r6pM, tool_uses=[toolu_01JsvB96FwYe2GJGRPS3XSD1]); [16] user(tool_results=[toolu_01JsvB96FwYe2GJGRPS3XSD1]); [17] assistant(id=msg_01QBAA9oGCHfey9NogAQuPjm, tool_uses=[toolu_011p28YdL65MV6FAFn9NfVcs]); [18] user(tool_results=[toolu_011p28YdL65MV6FAFn9NfVcs]); [19] assistant(id=msg_01REkB2sfGDog61yE69HvUtS, tool_uses=[toolu_012u5rrRCy5M1pnCmypKCABg]); [20] user(tool_results=[toolu_012u5rrRCy5M1pnCmypKCABg]); [21] assistant(id=msg_01VmU9BQi5T1qsRZePnyA5DG, tool_uses=[toolu_01YFFrtjb7VDTwrby3N5uuRx]); [22] user(tool_results=[toolu_01YFFrtjb7VDTwrby3N5uuRx]); [23] assistant(id=msg_01E6r8Zov9cynPqS5277KTfL, tool_uses=[toolu_01U23jf4d3LWhGkQHjEjQzFL]); [24] user(tool_results=[toolu_01U23jf4d3LWhGkQHjEjQzFL]); [25] assistant(id=msg_011xca39L1e4tzRAB3TCVQst, tool_uses=[toolu_01CExoTsta7LYZWJ7j7h3Yum]); [26] user(tool_results=[toolu_01CExoTsta7LYZWJ7j7h3Yum]); [27] assistant(id=msg_01GD5T2pFVMZ3qqpPJ4Cknd7, tool_uses=[toolu_013hqkU9Zrw3DLhF1JAeM5xc]); [28] user(tool_results=[toolu_013hqkU9Zrw3DLhF1JAeM5xc]); [29] assistant(id=msg_011s5oRJXEYMC2uQ8TTSmBqD, tool_uses=[toolu_01BjK3Xw22zZYVVym79s4n39]); [30] user(tool_results=[toolu_01BjK3Xw22zZYVVym79s4n39]); [31] assistant(id=msg_01DiyuqNWR1KBZvc1BR3YVri, tool_uses=[toolu_01WVVUz6N971imv7nwK62yRx]); [32] user(tool_results=[toolu_01WVVUz6N971imv7nwK62yRx]); [33] assistant(id=msg_014crNzxV6pFL7onFrs9jKXs, tool_uses=[toolu_019tHMpHNjpUprtWjVnXsjbb]); [34] user(tool_results=[toolu_019tHMpHNjpUprtWjVnXsjbb]); [35] assistant(id=msg_01EBYKdJPs4tVWBuuc16BMJQ, tool_uses=[toolu_01DUAwj8oF5MJa4batUE1euG]); [36] user(tool_results=[toolu_01DUAwj8oF5MJa4batUE1euG]); [37] assistant(id=msg_01DFTJ5eAqbnJAy5LP5m6NGd, tool_uses=[toolu_0175wjHXDCGt8rkubGiFhtoJ]); [38] user(tool_results=[toolu_0175wjHXDCGt8rkubGiFhtoJ]); [39] assistant(id=msg_01VcSpwA3fooWPNueAzW32f1, tool_uses=[toolu_01M5WXQSAWD91qqwWSC2W7gb]); [40] user(tool_results=[toolu_01M5WXQSAWD91qqwWSC2W7gb]); [41] assistant(id=msg_01F8G5ptWFeUELogok7wMpAj, tool_uses=[toolu_01VZsBb1zzn8UXBL26mnDqGj]); [42] user(tool_results=[toolu_01VZsBb1zzn8UXBL26mnDqGj]); [43] assistant(id=msg_01TKdNiQdzrkqWRBa6ftfibu, tool_uses=[toolu_012pUixc5M7sTFZNwsj6Rmpy]); [44] user(tool_results=[toolu_012pUixc5M7sTFZNwsj6Rmpy]); [45] assistant(id=msg_016Tw7HWFaDrd82ERMoC4USS, tool_uses=[toolu_01QZ9CcAnYEZGk5xBMYk8Sdb]); [46] user(tool_results=[toolu_01QZ9CcAnYEZGk5xBMYk8Sdb]); [47] assistant(id=msg_01LTAqbEEBRAJ5HSYQTiQyRR, tool_uses=[toolu_017EKv3snZZwtHKSpSubpDGa]); [48] user(tool_results=[toolu_017EKv3snZZwtHKSpSubpDGa]); [49] assistant(id=msg_01WqykGLB92E8tcXeoEPoZ9Q, tool_uses=[toolu_0154RiQ3xprsTHi41XW3bCqL]); [50] user(tool_results=[toolu_0154RiQ3xprsTHi41XW3bCqL]); [51] assistant(id=msg_01JwKnBUhvj9KCa42SMPLvPh, tool_uses=[toolu_01JUUf5YBPCdSbmATLKFvj82]); [52] user(tool_results=[toolu_01JUUf5YBPCdSbmATLKFvj82]); [53] assistant(id=msg_01Qmtn4KmqnVWoxECTHZAuzS, tool_uses=[toolu_0146feuEzV3LqUqDP666BS88]); [54] user(tool_results=[toolu_0146feuEzV3LqUqDP666BS88]); [55] assistant(id=msg_01Fvr2nZqVBarnYfnf27StWo, tool_uses=[toolu_01Qpdk4Z19rHRKfBrxJMyS2g]); [56] user(tool_results=[toolu_01Qpdk4Z19rHRKfBrxJMyS2g]); [57] assistant(id=msg_01Cs1YRP3M93RxGk7TvZwLUt, tool_uses=[toolu_01Wx5gcZpkaAYNMnotrxALJS]); [58] user(tool_results=[toolu_01Wx5gcZpkaAYNMnotrxALJS]); [59] assistant(id=msg_01FEmaYADQ2q2vwCoz65jD8j, tool_uses=[toolu_01UDH8fuwknNQAaSHK3rWWYJ,toolu_011cc1AJwQC3x4CSkapPFXmX,toolu_01HtJxMQYtXtMBfRisA7pHGJ]); [60] user(tool_results=[toolu_01UDH8fuwknNQAaSHK3rWWYJ,toolu_011cc1AJwQC3x4CSkapPFXmX,toolu_01HtJxMQYtXtMBfRisA7pHGJ]); [61] assistant(id=msg_01NmHybZn9KNvAS8n6gCEcAz, tool_uses=[toolu_018fxvABUhXSNpb4ULKf7ixF]); [62] user(tool_results=[toolu_…

Note: Content was truncated.

View original on GitHub ↗

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