kovidgoyal/kitty · warning
Clipboard write request has more data than allowed by clipbo
Error message
Clipboard write request has more data than allowed by clipboard_max_size ({self.max_size} bytes), ignoring further data What it means
A clipboard write request exceeded clipboard_max_size; kitty discards the excess data and marks the request as size-exceeded. The remainder of the transfer is ignored.
Source
Thrown at kitty/clipboard.py:356
self.currently_writing_mime = ''
if incomplete:
# the data is not padded to a multiple of four bytes. This is
# tolerated for the legacy OSC 52 protocol as it has no way to
# report errors to the client.
if self.protocol_type is ProtocolType.osc_5522:
raise self.abort('Incomplete base64 data, missing padding bytes')
log_error('Received incomplete data for clipboard')
def write_base64_data(self, b: bytes | memoryview) -> None:
if not self.max_size_exceeded:
try:
decoded = self.decoder.decode(b)
except ValueError as e:
raise self.abort(f'Invalid base64 data: {e}') from e
if decoded:
self.tempfile.write(decoded)
if self.max_size > 0 and self.tempfile.tell() > self.max_size:
log_error(f'Clipboard write request has more data than allowed by clipboard_max_size ({self.max_size} bytes), ignoring further data')
self.max_size_exceeded = True
def data_for(self, mime: str = 'text/plain', offset: int = 0, size: int = -1) -> bytes:
start, full_size = self.mime_map[mime]
if size == -1:
size = full_size
return self.tempfile.read(start + offset, size)
class GrantedPermission:
one_time: bool = False
write_ban: bool = False
read_ban: bool = False
def __init__(self, read: bool = False, write: bool = False, one_time: bool = False):
self.read, self.write = read, write
self.one_time = one_time
View on GitHub (pinned to 6d5d0c4406)
Solutions
- Raise `clipboard_max_size` in kitty.conf if the large copies are intended
- Fix the sender to not push oversized payloads
- Keep it as is if the cap is a deliberate security measure
Example fix
# before clipboard_max_size 10000000 # after clipboard_max_size 512000000
Defensive patterns
Strategy: validation
Validate before calling
size = len(payload) from kitty.config import defaults # pseudo if size > CLIPBOARD_MAX_SIZE: skip_or_split()
Prevention
- Set clipboard_max_size to match your real clipboard payloads
- Check payload size before pushing through OSC 52/5522
When it happens
Trigger: An app (OSC 52/5522) writes clipboard data larger than the configured `clipboard_max_size` (default 512MB, often lowered). tempfile.tell() exceeds max_size during write_base64_data.
Common situations: Users lowering clipboard_max_size to harden kitty, then copying huge images/files; remote sessions tunneling binary clipboard payloads.
Related errors
- Too much piped data
- This should be run as kitten broadcast
- No option named: {k}
- No custom kitten named {kitten} found
- Not a number: {x} with error: {e}
AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27).
Data as JSON: /api/errors/a0a52d130a57adbb.
Report an issue: GitHub.