{"record":{"id":"d2bf4157cfba14ac","repo":"kovidgoyal/kitty","slug":"failed-to-seek-in-image-data-output-file-s-with","errorCode":null,"errorMessage":"Failed to seek in image data output file: %s with error: %w","messagePattern":"Failed to seek in image data output file: (.+?) with error: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kittens/icat/transmit.go","lineNumber":95,"sourceCode":"\t\tif frame.compose_onto > 0 {\n\t\t\tgc.SetOverlaidFrame(uint64(frame.compose_onto))\n\t\t}\n\t\tgc.SetLeftEdge(uint64(frame.left)).SetTopEdge(uint64(frame.top))\n\t}\n\treturn gc\n}\n\nfunc transmit_shm(imgd *image_data, frame_num int, frame *image_frame) (err error) {\n\tvar mmap shm.MMap\n\tvar data_size int64\n\tif frame.in_memory_bytes == nil {\n\t\tf, err := os.Open(frame.filename)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to open image data output file: %s with error: %w\", frame.filename, err)\n\t\t}\n\t\tdefer f.Close()\n\t\tif data_size, err = f.Seek(0, io.SeekEnd); err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to seek in image data output file: %s with error: %w\", frame.filename, err)\n\t\t}\n\t\tif _, err = f.Seek(0, io.SeekStart); err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to seek in image data output file: %s with error: %w\", frame.filename, err)\n\t\t}\n\t\tif mmap, err = shm.CreateTemp(\"icat-*\", uint64(data_size)); err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to create a SHM file for transmission: %w\", err)\n\t\t}\n\t\tif _, err = io.ReadFull(f, mmap.Slice()); err != nil {\n\t\t\tmmap.Close()\n\t\t\tmmap.Unlink()\n\t\t\treturn fmt.Errorf(\"Failed to read data from image output data file: %w\", err)\n\t\t}\n\t} else {\n\t\tdata_size = int64(len(frame.in_memory_bytes))\n\t\tif mmap, err = shm.CreateTemp(\"icat-*\", uint64(data_size)); err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to create a SHM file for transmission: %w\", err)\n\t\t}\n\t\tcopy(mmap.Slice(), frame.in_memory_bytes)","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kittens/icat/transmit.go#L77-L113","documentation":"transmit_shm opened the frame file successfully but the Seek to the end (to determine data size) failed. The file's size can't be established, so transmission aborts.","triggerScenarios":"f.Seek(0, io.SeekEnd) returning an error — typically when the 'file' is a pipe/FIFO, has been truncated concurrently, or is on a filesystem returning EIO.","commonSituations":"frame.filename pointing at a FIFO or special file; concurrent truncation; failing disk/NFS mount.","solutions":["Ensure the frame file is a regular file, not a pipe","Keep encoded frames in memory (in_memory_bytes path) instead of files when possible","Check filesystem health if seeking regularly fails"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if fi, err := os.Stat(f); err != nil || !fi.Mode().IsRegular() { /* reject pipes/special files */ }","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"Failed to seek\") { /* retry with fresh file handle */ }","preventionTips":["Only use regular files for frame data","Avoid FIFOs as image sources"],"tags":["kitty","icat","shm","seek","filesystem"],"backgroundTag":"file-seek-failed","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}