Skip to content

[Bug] JSON Parse Error (13310) in Claude Code Action when commit messages contain Markdown links #753

@haeyongyoon-29cm

Description

@haeyongyoon-29cm

Title: [Bug] JSON Parse Error (13310) in Claude Code Action when commit messages contain Markdown links

Description

anthropics/claude-code-action@v1 throws a SyntaxError: JSON Parse error when processing Pull Requests where commit messages contain Markdown link syntax (e.g., [text](url)).

Error Logs

SDK execution error: 13310
SyntaxError: JSON Parse error: Unable to parse JSON string
      at readMessages (/home/runner/_work/_actions/anthropics/claude-code-action/v1/base-action/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs:13315:32)

Root Cause Analysis

The SDK fails to properly escape characters used in Markdown link syntax ([], ()) when serializing CLI configuration or environment data (mcp-config) into the JSONL stream.

Specifically, when Claude Code automatically generates or reads a commit message containing:
🤖 Generated with [Claude Code](https://claude.ai/claude-code)
The internal JSON stringification seems to produce an invalid JSON line, causing the readline interface in the SDK to fail during parsing.

Steps to Reproduce (Verification)

  1. Scenario A (Success): PR with a simple commit message (e.g., "fix: update logic"). ✅ Works
  2. Scenario B (Failure): PR with a Markdown link in the commit message (e.g., "refactor: use [Claude Code](https://www.google.com/search?q=url)"). ❌ Fails with Error 13310
  3. Recovery: After amending the commit message to remove the []() characters, the action runs successfully. ✅ Works

Suggested Fix

The SDK's message-passing layer should ensure that all CLI-derived strings (like commit messages, PR titles, etc.) are strictly escaped using a robust JSON serializer before being piped to stdout.

Environment

  • Action Version: anthropics/claude-code-action@v1
  • Runner: ubuntu-latest
  • Node.js: v18

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingp1Showstopper bug preventing substantial subset of users from using the product, or incorrect docs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions