[BUG] Bash commands fail with parentheses/brackets in file paths (Next.js route groups)

Resolved 💬 3 comments Opened Jan 22, 2026 by 01-binary Closed Jan 26, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Bash commands fail when file paths contain shell metacharacters like parentheses () or brackets [].

For example, with a Next.js App Router project using route groups:

  • Path: app/(home)/_components/
  • Error: no matches found: app/(home)/_components/

The shell interprets (home) as a glob pattern or subshell expression instead of a literal directory name.

What Should Happen?

Paths containing special shell characters should be automatically escaped or quoted, similar to how spaces in paths are already handled automatically (as documented: "Path with spaces: Bash commands automatically handle spaces").

Expected: app/(home)/ should work without manual escaping.

Error Messages/Logs

(eval):1: no matches found: /Users/jinsoo/Code/chore/binary01.me-notion-cms/app/(home)/_components/

Steps to Reproduce

  1. Create a Next.js App Router project with route groups:

mkdir -p "app/(home)/_components"
touch "app/(home)/_components/Page.tsx"

  1. In Claude Code, run any bash command referencing that path:
  • Ask Claude to list files: "list files in app/(home)/_components/"
  • Or run a command that involves that directory
  1. The bash command fails with "no matches found" error

Workaround: Manually quote the path works:

  • ls 'app/(home)/_components/'
  • ls app/\(home\)/_components/

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.11

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

VS Code integrated terminal

Additional Information

Affected path patterns (common in modern frameworks):

  • Next.js route groups: app/(home)/, app/(auth)/
  • Next.js dynamic routes: app/[id]/, app/[...slug]/
  • Optional catch-all: app/[[...slug]]/

Related:
The CHANGELOG mentions a similar fix was made before:

"Fixed bash commands failing on Windows when temp directory paths contained characters like t or n that were misinterpreted as escape sequences"

Shell characters that need escaping:

  • Parentheses: ()\(\) or '()'
  • Brackets: []\[\] or '[]'
  • And potentially: $, backticks, &, |, ;, etc.

Suggested fix:
Apply shell-safe quoting (like shlex.quote() in Python or equivalent) to file path arguments before passing to bash execution.

View original on GitHub ↗

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