anthropics / anthropics/claude-code-action

jq parse error on Unicode escape sequences causes workflow failure

Open
#712 2 comments 1 reaction 0 assignees View on GitHub
bug p2
Dominant language
TypeScript
Stars
8.9k
Forks
2.1k
Avg merge
3d 9h
Merged PRs (30d)
10

Description

## Bug Description

The `claude-code-action` fails during post-processing when the Claude output contains certain Unicode escape sequences that `jq` cannot parse.

## Error Message

```
##[warning]Failed to process output for execution metrics: Error: Command failed: jq -s '.' output.txt
jq: parse error: Invalid \uXXXX\uXXXX surrogate pair escape at line 60, column 9541

cat: /home/runner/work/_temp/claude-execution-output.json: No such file or directory
##[error]Process completed with exit code 1.
```

## Context

- The Claude review itself completed successfully
- The failure occurs in the action's post-processing step when trying to format output
- The `jq` parser fails on invalid Unicode surrogate pair escapes in the JSON output
- This causes the entire workflow to fail even though the actual task completed

## Reproduction

1. Run a code review workflow that produces output with Unicode characters
2. The output JSON contains escape sequences like `\uXXXX\uXXXX` that form invalid surrogate pairs
3. The `jq -s '.' output.txt` command fails
4. The workflow reports failure despite successful task completion

## Workflow Run

https://github.com/petter-b/homelab/actions/runs/19856099603

## Expected Behavior

The action should either:
1. Sanitize Unicode escape sequences before passing to `jq`
2. Handle `jq` parse errors gracefully without failing the workflow
3. Use a more robust JSON parser

## Environment

- Action version: `a7e4c51380c42dd89b127f5e5f9be7b54020bc6b`
- Runner: `ubuntu-latest`
- Model: `opus`

## Workaround

None currently - the workflow fails even when the review task completes successfully.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.