kovidgoyal/kitty · error · StreamError
Too much data being sent
Error message
Too much data being sent
What it means
StreamError raised by kitty's remote-control streaming mechanism when an incoming data stream exceeds 128 MiB. Remote control commands that transfer data (e.g. @ send-file, @ kitten payloads) buffer into a BytesIO; once the buffered size would pass the hard cap the stream is aborted to protect memory.
Source
Thrown at kitty/rc/base.py:319
from ..remote_control import close_active_stream
def abort_stream() -> None:
close_active_stream(self.stream_id)
self.stream_id = ''
if self.tempfile is not None:
self.tempfile.close()
self.tempfile = None
if stream_id != self.stream_id:
abort_stream()
self.stream_id = stream_id
if self.tempfile is None:
self.tempfile = BytesIO()
t = self.tempfile
if data:
if (t.tell() + len(data)) > 128 * 1024 * 1024:
abort_stream()
raise StreamError('Too much data being sent')
t.write(data)
return AsyncResponse()
close_active_stream(self.stream_id)
self.stream_id = ''
self.tempfile = None
t.flush()
return t
class RemoteCommand:
Args = ArgsHandling
CompletionSpec = CompletionSpec
name: str = ''
short_desc: str = ''
desc: str = ''
args: ArgsHandling = ArgsHandling()
options_spec: str | None = NoneView on GitHub (pinned to 6d5d0c4406)
Solutions
- Split the payload into chunks under 128 MiB and send multiple streams
- Compress the data before streaming
- For large file transfer, write to a temp file on disk and pass a path instead of streaming the bytes
Example fix
# before kitten @ send-file huge_video.mkv # > 128 MiB in-stream # after # stream in parts or reference by path gzip -c huge.bin | split -b 100m - part_ # then send parts kitten @ send-file --transfer-source part_aa
Defensive patterns
Strategy: validation
Validate before calling
MAX = 128 * 1024 * 1024
import os
if os.path.getsize(path) > MAX:
# split or compress instead of streaming
send_in_chunks(path, chunk=100 * 1024 * 1024)
else:
stream_file(path) Type guard
def is_streamable_size(size_bytes: int) -> bool:
return size_bytes < 128 * 1024 * 1024 Try / catch
from kitty.rc.base import StreamError
try:
stream.send(data)
except StreamError as e:
if 'Too much data' in str(e):
abort_and_chunk() # restart with smaller chunks
else:
raise Prevention
- Check payload size before initiating an rc stream
- Compress large payloads; prefer file paths over byte streaming
When it happens
Trigger: Streaming a payload larger than 128 MiB (134217728 bytes) to a remote-control command, cumulatively across chunks, e.g. sending a very large file via 'kitten @ send-file' or a custom streamed rc command.
Common situations: Sending large log dumps, binaries, or base64 blobs through remote control; scripts that retry and append to a stream causing double-buffering.
Related errors
- No stream_id in rc payload
- This should be run as kitten icat
- This should be run as `kitten notify ...`
- Remote control not enabled, this kitten should be run via a
- The remote control password was invalid: {data!r}
AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27).
Data as JSON: /api/errors/1447982272695f4b.
Report an issue: GitHub.