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

Custom timeout lengths for specific commands

Open ZeroMax-dev opened this issue 1 year ago • 5 comments

In the .claude/settings[.local].json we can set permissions for allowing or denying all kinds of commands. It would be great if we could also specify custom timeouts for single commands.

For example if Claude Code runs npm start actively, without running it in the background. This starts the frontend dev server. The command never finishes and needs to time out until Claude Code continues. In this case npm start should time out after 30 seconds. If Claude runs npm test however it should absolutely not time out after 30 seconds. A comprehensive test-suite could take well 30 minutes. The commands must definitely have enough time to run.

I know that I can override the timeout length for bash commands via the env vars BASH_DEFAULT_TIMEOUT_MS and BASH_MAX_TIMEOUT_MS but these apply to all commands. If I set the timeout very high, Claude Code will wait 30 minutes for npm start to timeout. Unfortunately it's using the "max timeout" unreliably so even with specific prompting it's hard to differentiate.

ZeroMax-dev avatar Jun 23 '25 19:06 ZeroMax-dev

I'm having the same issue. When Claude Code runs npm test it times out after 2 mins. Could this work?

https://github.com/anthropics/claude-code/issues/2314#issuecomment-3042174642

Jahonny avatar Jul 26 '25 15:07 Jahonny

On top of that BASH_DEFAULT_TIMEOUT_MS and BASH_MAX_TIMEOUT_MS don't even work properly - I use Claude Code to run lots of lengthy test scripts and sometimes it sorta gets impatient and starts applying 2 min timeouts randomly and re-configuring my test scripts to run 5% of the test cases to work around the timeouts on its own.

vitaly-castLabs avatar Aug 16 '25 03:08 vitaly-castLabs


Found 2 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/958
  2. https://github.com/anthropics/claude-code/issues/1999

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] avatar Aug 16 '25 06:08 github-actions[bot]

This issue has been automatically closed as a duplicate of #958.

If this is incorrect, please re-open this issue or create a new one.

🤖 Generated with Claude Code

github-actions[bot] avatar Aug 21 '25 09:08 github-actions[bot]

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

github-actions[bot] avatar Aug 29 '25 14:08 github-actions[bot]