Skip to content

document-skills plugin causes API 400 error due to binary PDF file (theme-showcase.pdf) #462

@raw34

Description

@raw34

Bug Description

Enabling the document-skills@anthropic-agent-skills plugin causes a 400 invalid_request_error when starting Claude Code sessions in some projects.

Error message:

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"The request body is not valid JSON: no low surrogate in string: line 1 column 29719 (char 29718)"},"request_id":"req_011CYSB4e4d24oGqnUT19dUE"}

Root Cause

The file skills/theme-factory/theme-showcase.pdf (124,310 bytes) is a binary PDF that contains 9 unpaired UTF-16 high surrogate byte sequences (0xED 0xA0-0xBF 0x80-0xBF in UTF-8 encoding).

When Claude Code loads the plugin, it appears to read this binary PDF as text content and includes it in the JSON request body sent to the API. The unpaired surrogates make the JSON invalid, causing the API to reject the request.

Steps to Reproduce

  1. Install and enable the document-skills@anthropic-agent-skills plugin in Claude Code
  2. Open a project with moderate context size (CLAUDE.md, etc.)
  3. Start a new conversation — API returns 400 error

Disabling the plugin immediately resolves the issue.

Suggested Fix

One or more of:

  • Exclude binary files (PDF, images, etc.) from plugin content loading
  • Add a .skillignore or similar mechanism to skip non-text assets
  • Convert theme-showcase.pdf to a non-binary format (e.g. screenshot image or markdown description)
  • Add binary file filtering in the plugin loader to skip files that aren't valid UTF-8 text

Workaround

Manually delete the cached PDF files:

rm ~/.claude/plugins/cache/anthropic-agent-skills/document-skills/*/skills/theme-factory/theme-showcase.pdf

Environment

  • Claude Code CLI (latest)
  • macOS
  • Plugin version: commit 1ed29a03dc85

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