Loading...
Loading...
Diagnose and repair 'invalid high surrogate' API errors in Claude Code chat sessions. Use this skill when the user encounters API Error 400 with 'invalid high surrogate in string', 'not valid JSON', surrogate-related errors, or wants to fix/scan/repair a broken Claude Code JSONL chat file. Also use when a session refuses to resume due to JSON encoding errors, or when the user mentions request IDs (req_...) alongside JSON parse failures.
npx skill4agent add tebjan/agent-skills fix-jsonl-surrogatesJSON.stringify()\uD8xxgrep -rl "req_XXXXX" ~/.claude/projects/*/# Scan a specific JSONL file + its session directory (subagents, tool-results)
python {SKILL_DIR}/scripts/fix_surrogates.py <path-to-file.jsonl>
# Dry run first to see what would change
python {SKILL_DIR}/scripts/fix_surrogates.py <path-to-file.jsonl> --dry-run --verbose
# Scan all sessions in a project directory
python {SKILL_DIR}/scripts/fix_surrogates.py ~/.claude/projects/<project-dir>/
# Scan everything recursively (includes subagent files)
python {SKILL_DIR}/scripts/fix_surrogates.py ~/.claude/projects/<project-dir>/ --recursiveerrors='surrogateescape'str.encode('utf-8', 'surrogatepass').decode('utf-8', 'replace').bakpython {SKILL_DIR}/scripts/fix_surrogates.py ~/.claude/ --recursive --dry-run{SKILL_DIR}{SKILL_DIR}