Skip to content

outputs malformed JSON with embedded ANSI terminal escape sequences #27530

@sean808080

Description

@sean808080

Severity: High (blocks JSON parsing/automation)

Environment:

  • macOS (Mac-mini, Homebrew install: /opt/homebrew/bin/openclaw)
  • openclaw version: 2026.2.25
  • Terminal: zsh

Steps to reproduce:

  1. Run the command: openclaw skills list --json | jq .
  2. The command fails with a JSON parsing error, such as: parse error: Invalid numeric literal at line 2, column 0

Root cause:
The JSON output from openclaw skills list --json is malformed. It contains raw, unescaped ANSI terminal escape sequences within the string values for fields like emoji and description. These control characters are not valid in a JSON string and cause all standard JSON parsers to fail.

Example of corrupted JSON:

{
  "name": "himalaya",
  "emoji": "📧M-^_M-^S📧" 
}

The M-^_M-^S sequence represents unescaped terminal control characters.

Impact:
This defect prevents any form of programmatic use or automation of the skills list --json command. It is impossible to parse the output with standard tools like jq, Python's json library, or any other compliant JSON parser.

Expected behavior:
The command should output a clean, well-formed JSON array with properly escaped strings, suitable for machine parsing. For example:

[
  {
    "name": "himalaya",
    "emoji": "📧",
    ...
  }
]

Workarounds (temporary):
Using grep on the invalid JSON can provide some basic information, but this is not a sustainable solution:

# Count total skills
openclaw skills list --json | grep -c '"name":'

# Count eligible skills
openclaw skills list --json | grep -c '"eligible": *true'

I have created two files that demonstrate the issue, which I will attach in a follow-up comment:

  • broken.json: A raw capture of the broken JSON output.
  • broken-cat-v.txt: The output viewed with cat -v to make the control characters visible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions