[BUG] Permission pattern matching fails when command contains # character

Resolved 💬 5 comments Opened Dec 3, 2025 by JacobPEvans-personal Closed Feb 18, 2026

Description

Permission patterns with the :* wildcard do not match commands that contain the # character. This affects Nix flake commands specifically.

Steps to Reproduce

  1. Add permission pattern to settings.json:

``json
"permissions": {
"allow": ["Bash(nix build:*)"]
}
``

  1. Run command containing #:

``bash
nix build .#darwinConfigurations.default.system
``

  1. Expected: Command auto-approves (matches Bash(nix build:*))
  2. Actual: Claude prompts for permission

Working vs Non-Working

| Command | Pattern | Works? |
|---------|---------|--------|
| nix build /path/to/flake | Bash(nix build:*) | ✅ Yes |
| nix build .#target | Bash(nix build:*) | ❌ No |
| nix flake check /path | Bash(nix flake check:*) | ✅ Yes |
| nix flake show .#foo | Bash(nix flake show:*) | ❌ No |

Workaround

Use command variants that don't require #:

  • nix flake check /absolute/path instead of nix build .#target
  • Specify full path without # fragment

Environment

  • Claude Code version: 2.0.56
  • OS: macOS (Darwin 25.1.0)
  • Shell: zsh

Impact

This affects all Nix/flake users who want to auto-approve common build commands. The # character is fundamental to Nix flake syntax for specifying outputs.

View original on GitHub ↗

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