{"record":{"id":"791aa0e0b3d5aa2d","repo":"kovidgoyal/kitty","slug":"s","errorCode":null,"errorMessage":"%s","messagePattern":"%s","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kittens/clipboard/read.go","lineNumber":244,"sourceCode":"\t}\n\tans.WriteString(\"\\x1b\\\\\")\n\treturn ans.String()\n}\n\nfunc encode(metadata map[string]string, payload string) string {\n\treturn Encode_bytes(metadata, utils.UnsafeStringToBytes(payload))\n}\n\nfunc error_from_status(status string) error {\n\tswitch status {\n\tcase \"ENOSYS\":\n\t\treturn fmt.Errorf(\"no primary selection available on this system\")\n\tcase \"EPERM\":\n\t\treturn fmt.Errorf(\"permission denied\")\n\tcase \"EBUSY\":\n\t\treturn fmt.Errorf(\"a temporary error occurred, try again later.\")\n\tdefault:\n\t\treturn fmt.Errorf(\"%s\", status)\n\t}\n}\n\nfunc parse_escape_code(etype loop.EscapeCodeType, data []byte) (metadata map[string]string, payload []byte, err error) {\n\tif etype != loop.OSC || !bytes.HasPrefix(data, utils.UnsafeStringToBytes(OSC_NUMBER+\";\")) {\n\t\treturn\n\t}\n\tparts := bytes.SplitN(data, utils.UnsafeStringToBytes(\";\"), 3)\n\tmetadata = make(map[string]string)\n\tif len(parts) > 2 && len(parts[2]) > 0 {\n\t\tpayload, err = base64.StdEncoding.DecodeString(utils.UnsafeBytesToString(parts[2]))\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"Received OSC %s packet from terminal with invalid base64 encoded payload\", OSC_NUMBER)\n\t\t\treturn\n\t\t}\n\t}\n\tif len(parts) > 1 {\n\t\tfor record := range bytes.SplitSeq(parts[1], utils.UnsafeStringToBytes(\":\")) {","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kittens/clipboard/read.go#L226-L262","documentation":"error_from_status's default branch: the remote peer returned a status string that is not one of ENOSYS/EPERM/EBUSY, and it is surfaced verbatim. This usually indicates a protocol-level error or an unrecognized failure code from the terminal/client.","triggerScenarios":"A remote client replying with an unexpected status (malformed handshake, an error string from a different kitty version, or a bug in the peer implementation) over the OSC clipboard channel.","commonSituations":"Version skew between kitty and the remote kitten/ssh kitten forwarding the clipboard; third-party terminal emulators implementing the kitty clipboard protocol partially; corrupted OSC packets.","solutions":["Inspect the raw status string in the message to identify its origin","Update kitty on both ends (local and remote over ssh) to matching versions","If using a non-kitty terminal, verify it implements the kitty clipboard protocol fully or disable the feature","Report the unknown status to kitty's issue tracker with both versions"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"out=$(kitten clipboard get f 2>&1) || { echo \"$out\" >> clipboard-errors.log; exit 1; }  # capture unknown status for triage","preventionTips":["Log the raw status string for diagnosis","Keep kitty versions matched across ssh hops"],"tags":["kitty","clipboard","protocol","unknown-status"],"backgroundTag":"unknown-protocol-status","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}