sse-chunk-boundary-debug

Diagnose and fix JSON parse errors from SSE chunk boundary splits.

2|Updated May 10, 2026
One-click install
npx skills add https://github.com/freedomw1987/tree_monstor --skill sse-chunk-boundary-debug
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sse-chunk-boundary-debug
Source: https://github.com/freedomw1987/tree_monstor/tree/main/skills/debugging/sse-chunk-boundary-debug
Command: npx skills add https://github.com/freedomw1987/tree_monstor --skill sse-chunk-boundary-debug

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill resolves the "Unterminated string in JSON" parse error that occurs in browser SSE streams when HTTP chunked transfer encoding splits large SSE data lines (such as base64-encoded image payloads) mid-content, breaking standard line-based SSE parsing logic.

Core Features & Use Cases

  • Diagnostic Workflow: Step-by-step checks to rule out nginx misconfiguration as the root cause of SSE parse failures.
  • Line Buffer Accumulator Fix: Implements a proven pattern to reassemble split SSE lines across chunk boundaries before JSON parsing.
  • Use Case: Debug and fix broken SSE streaming for AI chatbot frontends that send large base64 image payloads via server-sent events from backend services.

Quick Start

Use the sse-chunk-boundary-debug skill to resolve the "Unterminated string in JSON" parse error occurring in your browser when receiving large base64 image payloads via server-sent events.

Frequently Asked Questions about sse-chunk-boundary-debug

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does JSON parse error happen with SSE streams receiving base64 payloads through nginx?

JSON parse errors in SSE streams occur when HTTP chunked transfer encoding splits large base64 data lines mid-payload, delivering incomplete JSON fragments to the browser. This happens even with correct nginx configuration when payloads exceed chunk boundary sizes.

How do I fix unterminated string in JSON errors in browser server-sent events?

Fix unterminated string errors by implementing a line buffer accumulator pattern that reassembles split SSE lines across chunk boundaries before attempting JSON parsing. This accumulates partial data fragments until complete SSE data lines are formed.

Do I need to change nginx configuration to resolve SSE chunk splitting issues?

No nginx configuration changes are needed when diagnostics confirm nginx is correctly configured. The fix applies to frontend SSE parsing logic by implementing a line buffer accumulator to handle chunked transfer encoding splits client-side.

What is a line buffer accumulator pattern for SSE stream processing?

A line buffer accumulator pattern reassembles split SSE data lines across HTTP chunk boundaries by accumulating partial text fragments until a complete line terminator is reached, then passing intact lines to JSON parsing. This prevents parse failures from incomplete fragments.

How to debug SSE streaming for AI chatbot frontends sending large base64 image payloads?

Debug SSE streaming for AI chatbot frontends by first verifying nginx configuration is correct, then implementing a line buffer accumulator to reassemble chunked transfer encoding splits. This targets base64 image payloads that break standard line-based SSE parsing.

When should I use a line buffer accumulator for server-sent event parsing?

Use a line buffer accumulator when receiving large SSE payloads via chunked transfer encoding where data lines split mid-content. It is specifically needed when standard line-based SSE parsing fails on base64-encoded payloads routed through nginx.