{"record":{"id":"1447982272695f4b","repo":"kovidgoyal/kitty","slug":"too-much-data-being-sent","errorCode":null,"errorMessage":"Too much data being sent","messagePattern":"Too much data being sent","errorType":"exception","errorClass":"StreamError","httpStatus":null,"severity":"error","filePath":"kitty/rc/base.py","lineNumber":319,"sourceCode":"        from ..remote_control import close_active_stream\n\n        def abort_stream() -> None:\n            close_active_stream(self.stream_id)\n            self.stream_id = ''\n            if self.tempfile is not None:\n                self.tempfile.close()\n                self.tempfile = None\n\n        if stream_id != self.stream_id:\n            abort_stream()\n            self.stream_id = stream_id\n        if self.tempfile is None:\n            self.tempfile = BytesIO()\n        t = self.tempfile\n        if data:\n            if (t.tell() + len(data)) > 128 * 1024 * 1024:\n                abort_stream()\n                raise StreamError('Too much data being sent')\n            t.write(data)\n            return AsyncResponse()\n        close_active_stream(self.stream_id)\n        self.stream_id = ''\n        self.tempfile = None\n        t.flush()\n        return t\n\n\nclass RemoteCommand:\n    Args = ArgsHandling\n    CompletionSpec = CompletionSpec\n\n    name: str = ''\n    short_desc: str = ''\n    desc: str = ''\n    args: ArgsHandling = ArgsHandling()\n    options_spec: str | None = None","sourceCodeStart":301,"sourceCodeEnd":337,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kitty/rc/base.py#L301-L337","documentation":"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.","triggerScenarios":"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.","commonSituations":"Sending large log dumps, binaries, or base64 blobs through remote control; scripts that retry and append to a stream causing double-buffering.","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"],"exampleFix":"# before\nkitten @ send-file huge_video.mkv   # > 128 MiB in-stream\n\n# after\n# stream in parts or reference by path\ngzip -c huge.bin | split -b 100m - part_  # then send parts\nkitten @ send-file --transfer-source part_aa","handlingStrategy":"validation","validationCode":"MAX = 128 * 1024 * 1024\nimport os\nif os.path.getsize(path) > MAX:\n    # split or compress instead of streaming\n    send_in_chunks(path, chunk=100 * 1024 * 1024)\nelse:\n    stream_file(path)","typeGuard":"def is_streamable_size(size_bytes: int) -> bool:\n    return size_bytes < 128 * 1024 * 1024","tryCatchPattern":"from kitty.rc.base import StreamError\ntry:\n    stream.send(data)\nexcept StreamError as e:\n    if 'Too much data' in str(e):\n        abort_and_chunk()  # restart with smaller chunks\n    else:\n        raise","preventionTips":["Check payload size before initiating an rc stream","Compress large payloads; prefer file paths over byte streaming"],"tags":["kitty","remote-control","streaming","size-limit"],"backgroundTag":"payload-too-large","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}