Claude repeatedly fails GraphQL quoting with gh api

Resolved 💬 2 comments Opened Mar 16, 2026 by rstarkey-block Closed Apr 13, 2026

Problem

Claude consistently constructs gh api graphql queries on a single line with $variables, causing bash interpolation errors. This results in GraphQL parse failures like:

Expected VAR_SIGN, actual: UNKNOWN_CHAR

Details

This is a recurring pattern — not a gh bug, but Claude making the same bash quoting mistake repeatedly despite having corrected it in prior turns within the same conversation.

When Claude generates something like:

gh api graphql -f query='{ repository(owner: "$owner", name: "$repo") { ... } }'

Bash interprets $owner and $repo as shell variables, breaking the GraphQL query.

Expected Behavior

Claude should always use multi-line format with proper quoting for GraphQL queries:

gh api graphql -f query='
  query($owner: String!, $repo: String!) {
    repository(owner: $owner, name: $repo) {
      ...
    }
  }
' -f owner="value" -f repo="value"

Impact

This wastes multiple conversation turns debugging the same quoting issue each time, and Claude often repeats the same mistake even after being corrected within the same session.

🤖 Generated with Claude Code

View original on GitHub ↗

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