{"record":{"id":"acaa8960568e4c7a","repo":"kovidgoyal/kitty","slug":"failed-to-read-data-from-the-clipboard-with-error","errorCode":null,"errorMessage":"Failed to read data from the clipboard with error: %w","messagePattern":"Failed to read data from the clipboard with error: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kittens/clipboard/read.go","lineNumber":414,"sourceCode":"\t\t\t\t\t\t}\n\t\t\t\t\t\tgetting_data_for = current_mime\n\t\t\t\t\t}\n\t\t\t\t\tif !o.all_data_received {\n\t\t\t\t\t\to.add_data(payload)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase \"OK\":\n\t\t\tcase \"DONE\":\n\t\t\t\tif prev := requested_mimes[getting_data_for]; getting_data_for != \"\" && prev != nil && !prev.all_data_received {\n\t\t\t\t\tprev.all_data_received = true\n\t\t\t\t\twg.Go(func() {\n\t\t\t\t\t\tprev.commit()\n\t\t\t\t\t})\n\t\t\t\t\tgetting_data_for = \"\"\n\t\t\t\t}\n\t\t\t\tlp.Quit(0)\n\t\t\tdefault:\n\t\t\t\treturn fmt.Errorf(\"Failed to read data from the clipboard with error: %w\", error_from_status(metadata[\"status\"]))\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\n\tesc_count := 0\n\tlp.OnKeyEvent = func(event *loop.KeyEvent) error {\n\t\tif event.MatchesPressOrRepeat(\"ctrl+c\") || event.MatchesPressOrRepeat(\"esc\") {\n\t\t\tevent.Handled = true\n\t\t\tesc_count++\n\t\t\tif esc_count < 2 {\n\t\t\t\tkey := \"Esc\"\n\t\t\t\tif event.MatchesPressOrRepeat(\"ctrl+c\") {\n\t\t\t\t\tkey = \"Ctrl+C\"\n\t\t\t\t}\n\t\t\t\tlp.QueueWriteString(fmt.Sprintf(\"Waiting for response from terminal, press %s again to abort. This could cause garbage to be spewed to the screen.\\r\\n\", key))\n\t\t\t} else {\n\t\t\t\treturn fmt.Errorf(\"Aborted by user!\")","sourceCodeStart":396,"sourceCodeEnd":432,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kittens/clipboard/read.go#L396-L432","documentation":"In the data-transfer phase, once the peer has agreed on a MIME type, any response status other than DATA/OK/DONE is wrapped as 'Failed to read data from the clipboard' around error_from_status. The inner message names the concrete failure that aborted the payload download.","triggerScenarios":"`kitten clipboard get dest` after the MIME negotiation succeeded, when the peer aborts mid-transfer with EPERM (revoked permission), EBUSY (owner busy), or an unknown status; large payloads failing partway also surface here.","commonSituations":"User denying the confirmation after negotiation started; clipboard owner replacing content mid-read; ssh/mosh connections dropping during transfer; tmux mangling long sequences.","solutions":["Inspect the inner status message: EPERM → approve/authorize; EBUSY → retry after a delay; unknown → update kitty versions","Re-copy the content on the sender and retry the whole get operation","For large payloads prefer getfile to avoid inline transfer limits","Stabilize the transport (avoid tmux reflow, enable passthrough)"],"exampleFix":"# before\nkitten clipboard get big.png   # aborts mid-transfer\n# after\nkitten clipboard getfile --mime image/png big.png","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"for i in 1 2 3; do kitten clipboard getfile --mime image/png out.png && break; sleep 1; done","preventionTips":["Retry the full get after re-copying on the sender","Prefer getfile for large payloads","Authorize non-interactively with --password/--human-name to avoid mid-transfer EPERM"],"tags":["kitty","clipboard","transfer-abort","protocol-status"],"backgroundTag":"clipboard-transfer-aborted","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}