[BUG] Command parsing for permissions incorrectly handles # even when properly commented

Resolved 💬 5 comments Opened Mar 13, 2026 by adamcstephens Closed Apr 18, 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?

When claude code tries to run a command that has a pound # in it, even if properly quoted, it forces a user prompt every time. It seems it's passing at least one permissions check as it doesn't show the mid-word warning that can't be remembered.

This is especially frustrating with nix flakes, which use a # as separator with meaning. It prompts on every invocation and there appears to be no way to avoid the prompt.

Choosing "Yes, don't ask again" is futile, this prompt will always recur.

● Bash(nix run 'nixpkgs#cowsay')
  ⎿  Running…

────────────────────────────────────────────────────────────────────────────────────
 Bash command

   nix run 'nixpkgs#cowsay'
   Run cowsay from nixpkgs

 This command requires approval

 Do you want to proceed?
 ❯ 1. Yes
   2. Yes, and don’t ask again for: nix run:*
   3. No

For reference, here's the same without quotes:

❯ Run: `nix run nixpkgs#cowsay`

● Bash(nix run nixpkgs#cowsay)
  ⎿  Running…

────────────────────────────────────────────────────────────────────────────────────
 Bash command

   nix run nixpkgs#cowsay
   Run cowsay from nixpkgs

 Command contains mid-word # which is parsed differently by shell-quote vs bash

 Do you want to proceed?
 ❯ 1. Yes
   2. No

What Should Happen?

I'd expect an approval for "Bash(nix run:*)" to be respected in this case and not prompt the user.

Error Messages/Logs

Steps to Reproduce

  1. Ask claude to nix run 'nixpkgs#cowsay'
  2. Choose option 2, "Yes, and don't ask again"
  3. Ask claude to nix run 'nixpkgs#cowsay' again
  4. See that you're prompted anyway.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.74 (Claude Code)

Platform

Anthropic API

Operating System

Other Linux

Terminal/Shell

Other

Additional Information

_No response_

View original on GitHub ↗

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