Skip to content

[BUG] Multiline claude_args with Bash tools containing spaces parsed incorrectly #844

@vertti

Description

@vertti

Bug Description

When using multiline YAML for claude_args with Bash tool patterns that contain spaces (like Bash(git diff --name-only HEAD~1)), the SDK incorrectly parses the --allowedTools argument by splitting on spaces.

Reproduction

claude_args: |
  --max-turns 15
  --allowedTools Bash(git diff --name-only HEAD~1),Bash(git diff HEAD~1),Read,Glob,Grep

Expected Behavior

SDK should parse allowedTools as:

["Bash(git diff --name-only HEAD~1)", "Bash(git diff HEAD~1)", "Read", "Glob", "Grep"]

Actual Behavior

SDK parses allowedTools as:

["Bash", "git", "diff"]

From the logs:

SDK options: {
  "allowedTools": [
    "Bash",
    "git",
    "diff"
  ],
  ...
  "extraArgs": {
    "max-turns": "15",
    "name-only": "HEAD~1"
  },
  ...
}

Note that --name-only HEAD~1 is also incorrectly parsed as a separate extraArg.

Evidence

Full error:

SDK execution error: error: Claude Code process exited with code 1

Workaround

Put everything on a single line with quotes:

claude_args: --max-turns 15 --allowedTools "Bash(git diff --name-only HEAD~1),Bash(git diff HEAD~1),Read,Glob,Grep"

Environment

  • Action version: anthropics/claude-code-action@v1
  • Runner: ubuntu-latest
  • Event: pull_request

Notes

The migration guide shows multiline claude_args examples, but they don't include Bash tools with spaces:

claude_args: |
  --max-turns 15
  --allowedTools Edit,Read,Write,Bash

The issue appears to be that shell-quote (or whatever parser is used) doesn't handle the multiline + spaces-in-arguments combination correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingp2Non-showstopper bug or popular feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions