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

[BUG] increasing timeout environmental variable

Open achimstruve opened this issue 7 months ago • 3 comments

Environment

  • Platform (select one):
    • [ ] Anthropic API
    • [ ] AWS Bedrock
    • [ ] Google Vertex AI
    • [x ] Other: Local Windows
  • Claude CLI version: 1.0.16
  • Operating System: Windows 11 with WSL
  • Terminal: command window on windows via WSL

Bug Description

I am getting this error: Error: Command timed out after 2m 0.0s once I run a longer bash command, such as installing the dependencies of an environment, which can take some time..

Using the approach outlined in the documentation doesn't work for me.

I have a local project .claude/settings.local.json file that looks like this:

  "permissions": {
    "allow": [
      "Bash(mkdir:*)",
      "Bash(python3:*)",
      "Bash(sudo apt:*)",
      "Bash(sudo apt install:*)",
      "Bash(ls:*)",
      "Bash(source:*)",
      "Bash(pip install:*)",
      "Bash(node:*)",
      "Bash(npm --version)",
      "Bash(npm install)",
      "Bash(rm:*)"
    ],
    "deny": []
  }
  "env": {
    "BASH_DEFAULT_TIMEOUT_MS": "900000",
    "BASH_MAX_TIMEOUT_MS": "900000"
  }
}

Also I created a global ~/.claude/settings.json file with the same content. Still I am getting the error..

Moreover using the claude config list -g command shows me a set of completely different settings and variables, such as:

  "autoUpdaterStatus": "not_configured",
  "theme": "dark",
  "verbose": "true",
  "preferredNotifChannel": "auto",
  "editorMode": "normal",
  "autoCompactEnabled": false,
  "diffTool": "auto",
  "env": {},
  "tipsHistory": {
    "new-user-warmup": 1,
    "memory-command": 7,
    "theme-command": 8,
    "prompt-queue": 9,
    "enter-to-steer-in-relatime": 10,
    "todo-list": 11,
    "# for memory": 12,
    "install-github-app": 13,
    "permissions": 14,
    "drag-and-drop-images": 15,
    "double-esc": 16,
    "continue": 17,
    "custom-commands": 18,
    "shift-tab": 19
  },
  "parallelTasksCount": 1,
  "todoFeatureEnabled": true,
  "messageIdleNotifThresholdMs": 60000
}

Here we see that no env variables got defined apparently. However, there is another variable "messageIdleNotifThresholdMs": 60000 that might be related to the topic, but has a one minute value and there is probably not relevant.

Steps to Reproduce

  1. Define a requirements.txt file with dependencies that require a lot of time to install or another bash command that takes a couple of minutes to execute. See mine as reference:
fastapi==0.104.1
uvicorn[standard]==0.24.0
sqlalchemy==2.0.23
alembic==1.12.1
celery==5.3.4
redis==5.0.1
google-auth==2.23.4
google-auth-oauthlib==1.1.0
google-auth-httplib2==0.1.1
google-api-python-client==2.108.0
google-cloud-texttospeech==2.14.2
requests==2.31.0
pydantic==2.5.0
pydantic-settings==2.1.0
python-multipart==0.0.6
python-jose[cryptography]==3.3.0
passlib[bcrypt]==1.7.4
python-dotenv==1.0.0

# Development dependencies
pytest==7.4.3
pytest-asyncio==0.21.1
black==23.11.0
flake8==6.1.0
httpx==0.25.2
  1. Let claude run that bash command

Expected Behavior

I'd expect that the definition of these environmental variables as shown above would increase the timeout time. 2 minutes is too little for more complex operations.

Actual Behavior

The setup of the environmental variables does not have any effect.

achimstruve avatar Jun 06 '25 16:06 achimstruve

NOT a solution to your problem but have you tried usig uv for dependency resolution instead of pip (which you whitelisted)? It really is a significant performance improvement.

michael-hedgineer avatar Jun 06 '25 17:06 michael-hedgineer

Thank you @michael-hedgineer! This helped me a lot as the setup via the uv command was much faster.

We can leave this open to ensure this bug (or my misunderstanding of the documentation) is resolved.

achimstruve avatar Jun 06 '25 17:06 achimstruve

@achimstruve for sure. Still want to follow along to make sure that you are able to successfully modify the task timeouts as this is a usecase I have had but haven't bother investigating. The Agent tasks definitely go beyond 2 minutes.

michael-hedgineer avatar Jun 06 '25 17:06 michael-hedgineer

I can now confirm that the usage of the environmental variables

 "env": {
    "BASH_DEFAULT_TIMEOUT_MS": "900000",
    "BASH_MAX_TIMEOUT_MS": "900000"
  }

in the global ~/.claude/settings.json file do have the desired effect. I don't know why it works now, but it does!

achimstruve avatar Jun 08 '25 07:06 achimstruve

Thanks for following up to confirm it worked!


From: Achim Struve @.> Sent: Sunday, June 8, 2025 3:40:09 AM To: anthropics/claude-code @.> Cc: Michael Watson @.>; Mention @.> Subject: Re: [anthropics/claude-code] [BUG] increasing timeout environmental variable (Issue #1717)

[https://avatars.githubusercontent.com/u/25647387?s=20&v=4]achimstruve left a comment (anthropics/claude-code#1717)https://github.com/anthropics/claude-code/issues/1717#issuecomment-2953677913

I can now confirm that the usage of the environmental variables

"env": { "BASH_DEFAULT_TIMEOUT_MS": "900000", "BASH_MAX_TIMEOUT_MS": "900000" }

in the global ~/.claude/settings.json file do have the desired effect. I don't know why it works now, but it does!

— Reply to this email directly, view it on GitHubhttps://github.com/anthropics/claude-code/issues/1717#issuecomment-2953677913, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A6QOOYPLYGVZQTJEMYTEEJL3CPSFTAVCNFSM6AAAAAB6YQY4C6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDSNJTGY3TOOJRGM. You are receiving this because you were mentioned.Message ID: @.***>

Michael Watson

@.@.>

hedgineer.iohttps://www.hedgineer.io

H E D G I N E E R

michael-hedgineer avatar Jun 08 '25 10:06 michael-hedgineer

I have a settings file in my project and also a settings file in my ~/.claude directory. Despite setting a 10-minute timeout for all commands, I'm still encountering the error Error: Command timed out after 2m 0.0s. I can't find a way to increase the timeout.

Image

mreduar avatar Jul 03 '25 15:07 mreduar

any fix for this ?

trinib avatar Jul 27 '25 13:07 trinib

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 03 '25 14:08 github-actions[bot]