Skip to content

[BUG] Annoying prompts "Command contains quote characters inside a # comment which can desync quote tracking" for safe, allowed commands #30345

@AndiDog

Description

@AndiDog

Preflight Checklist

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

What's Wrong?

In this and many other examples, a commented Bash script is created, containing a simple command that I globally allowed in permission (e.g. "Bash(grep:*)"):

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

   # Check "make docker build-all" vs "make docker-build-all" - AGENTS.md says "make docker build-all"
   # which would be interpreted as `make docker` (no such target) + `build-all` (passing build-all as arg)
   grep -n "make docker" /[...snip - this is inside the project directory...]/AGENTS.md
   Check the exact make command in AGENTS.md

 Command contains quote characters inside a # comment which can desync quote tracking

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

What Should Happen?

I don't want to be asked for confirmation here, given that full-line Bash comments can be ignored. I couldn't find the code for the "desync quote tracking" warning. If safe Bash comments (full-line ones, I guess) could be removed before the permissions check, I assume this example would work without confirmation.

Error Messages/Logs

Steps to Reproduce

This happens in many cases where Claude researches stuff in the codebase, for instance the /code-review plugin.

My current, global permission list:

{
  "permissions": {
    "allow": [
      "Bash(deadcode:*)",
      "Bash(find:*)",
      "Bash(gh pr diff:*)",
      "Bash(gh pr view:*)",
      "Bash(git diff)",
      "Bash(git status)",
      "Bash(go build:*)",
      "Bash(go doc:*)",
      "Bash(go get:*)",
      "Bash(go list:*)",
      "Bash(go mod:*)",
      "Bash(go test:*)",
      "Bash(go vet:*)",
      "Bash(golangci-lint run:*)",
      "Bash(grep:*)",
      "Bash(head:*)",
      "Bash(ls:*)",
      "Bash(make test:*)",
      "Bash(prek run:*)",
      "Bash(prek)",
      "Bash(staticcheck:*)",
      "Bash(tail:*)",
      "Bash(xxd:*)",
      "Grep",
      "LS",
      "Read"
    ]
  },
[...]

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.63

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions