{"record":{"id":"83f3d17da9b2890c","repo":"kovidgoyal/kitty","slug":"failed-to-read-requested-mime-type-mime-with-err","errorCode":null,"errorMessage":"Failed to read requested mime type {mime} with error: {e}","messagePattern":"Failed to read requested mime type (.+?) with error: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"kitty/clipboard.py","lineNumber":681,"sourceCode":"        def write_chunks(data: bytes) -> None:\n            assert w is not None\n            mv = memoryview(data)\n            while mv:\n                w.screen.send_escape_code_to_child(ESC_OSC, rr.encode_response(payload=mv[:READ_RESPONSE_CHUNK_SIZE], mime=current_mime))\n                mv = mv[READ_RESPONSE_CHUNK_SIZE:]\n\n        for mime in rr.mime_types:\n            current_mime = mime\n            if mime == TARGETS_MIME:\n                payload = ' '.join(cp.get_available_mime_types_for_paste()).encode('utf-8')\n                if payload:\n                    payload += b'\\n'\n                w.screen.send_escape_code_to_child(ESC_OSC, rr.encode_response(payload=payload, mime=current_mime))\n                continue\n            try:\n                cp.get_mime(mime, write_chunks)\n            except Exception as e:\n                log_error(f'Failed to read requested mime type {mime} with error: {e}')\n        w.screen.send_escape_code_to_child(ESC_OSC, rr.encode_response(status='DONE'))\n\n    def reject_read_request(self, rr: ReadRequest) -> None:\n        if rr.protocol_type is ProtocolType.osc_52:\n            return self.fulfill_legacy_read_request(rr, False)\n        w = get_boss().window_id_map.get(self.window_id)\n        if w is not None:\n            w.screen.send_escape_code_to_child(ESC_OSC, rr.encode_response(status='EPERM'))\n\n    def fulfill_legacy_read_request(self, rr: ReadRequest, allowed: bool = True) -> None:\n        cp = get_boss().primary_selection if rr.is_primary_selection else get_boss().clipboard\n        w = get_boss().window_id_map.get(self.window_id)\n        if w is not None:\n            text = ''\n            if cp.enabled and allowed:\n                text = cp.get_text()\n            loc = 'p' if rr.is_primary_selection else 'c'\n            w.screen.send_escape_code_to_child(ESC_OSC, encode_osc52(loc, text))","sourceCodeStart":663,"sourceCodeEnd":699,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kitty/clipboard.py#L663-L699","documentation":"While fulfilling a clipboard read request, reading the requested MIME type from the clipboard provider (cp.get_mime) raised; kitty logs it and continues with the remaining MIME types, ending the response with DONE.","triggerScenarios":"A read request asking for a MIME type the OS clipboard has no data for, or the OS clipboard API raising during retrieval (e.g. Wayland/X11 clipboard manager hiccup, image MIME missing).","commonSituations":"Clients requesting image/png when only text is present on servers that error instead of returning empty; races where the clipboard owner disappears mid-read.","solutions":["Only request MIME types you know may be present (or handle empty responses gracefully)","Retry the read once — clipboard owner races are transient","Update kitty; provider-specific bugs get patched"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"null  # cannot validate OS clipboard contents reliably beforehand","typeGuard":null,"tryCatchPattern":"try:\\n    cp.get_mime(mime, write_chunks)\\nexcept Exception:\\n    continue  # skip this MIME type, response still ends DONE","preventionTips":["Request only plausible MIME types","Retry once on transient clipboard-owner races"],"tags":["kitty","clipboard","mime","read-request"],"backgroundTag":"clipboard-read-failed","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}