#6789 🐛 BUG: ERROR SystemError [ERR_TTY_INIT_FAILED] While installing using Git Bash
Implement isTTYSupported() function in @cloudflare/cli to handle unsupported terminals gracefully
No
Analysis Report
Issue Review: cloudflare/workers-sdk#6789
Summary
npm create cloudflare@latest fails with ERR_TTY_INIT_FAILED when run in Git Bash on Windows due to the terminal not supporting raw mode.
Findings
- Created: 2024-09-20
- Updated: 2025-10-30
- Version: C3 2.27.3 → 2.62.3 (current)
- Component: create-cloudflare (C3) / @cloudflare/cli
- Labels: bug
- Comments: 3
Key Evidence
Issue is reproducible and confirmed by reporter: The reporter confirmed on 2024-10-09 that the issue persists in Git Bash, suggesting using PowerShell instead as a workaround.
Similar issue fixed for wrangler but not C3: Issue #1992 (wrangler init failing in Git Bash) was fixed in wrangler 2.7.1 by migrating from Ink to prompts. However, C3 uses
@clack/corevia@cloudflare/cli, which has the same TTY/raw mode limitation.Maintainer identified a potential fix approach: @andyjessop noted (2024-11-04) that wrangler handles this by falling back to "raw mode" when TTY is not supported, referencing
packages/wrangler/src/utils/onKeyPress.ts. He suggested creating a generalizedisTTYSupported()function to handle this in C3.No merged PRs or changelog entries fixing this issue: Searched for PRs mentioning #6789, TTY, Git Bash, isTTYSupported - none found addressing this in C3.
Root cause: The
@clack/corelibrary (v0.3.2 in @cloudflare/cli) callsprocess.stdin.setRawMode(true)during interactive prompts, which fails in Git Bash withERR_TTY_INIT_FAILED: TTY initialization failed: uv_tty_init returned EBADF.
Recommendation
Status: KEEP OPEN
Reasoning: This is a legitimate, confirmed bug that affects Windows users running Git Bash. A similar issue was fixed for wrangler, and a maintainer has identified a potential fix approach (creating an isTTYSupported() function to gracefully handle unsupported terminals). The issue has been open since September 2024 with no fix implemented yet.
Action: The issue should remain open. The suggested fix approach from @andyjessop should be implemented: create an isTTYSupported() function in @cloudflare/cli that checks for TTY support before calling setRawMode(), similar to how wrangler handles it in onKeyPress.ts.
Workaround
Users can work around this issue by using PowerShell or Windows Command Prompt instead of Git Bash.
Notes & Feedback (0)
No notes yet.