{"record":{"id":"c189500444dd85e5","repo":"kovidgoyal/kitty","slug":"failed-to-open-image-data-output-file-s-with-err","errorCode":null,"errorMessage":"Failed to open image data output file: %s with error: %w","messagePattern":"Failed to open image data output file: (.+?) with error: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kittens/icat/transmit.go","lineNumber":91,"sourceCode":"\t} else {\n\t\tgc.SetAction(graphics.GRT_action_frame)\n\t\tgc.SetGap(int32(frame.delay_ms))\n\t\tgc.SetCompositionMode(utils.IfElse(frame.replace, graphics.Overwrite, graphics.AlphaBlend))\n\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))","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kittens/icat/transmit.go#L73-L109","documentation":"In the shared-memory transmission path, icat tried to os.Open the frame's on-disk file (frame.filename) before copying it into an shm segment, and the open failed.","triggerScenarios":"Frame data was written to a temp file that has been deleted or is unreadable (permissions, ENOENT) by the time transmit_shm runs.","commonSituations":"Temp cleanup races on busy systems; file removed by concurrent process; permission mismatch when running under different users; disk-backed tempdir issues.","solutions":["Check that the intermediate file still exists and is readable when transmission starts","Avoid aggressive temp-dir cleaners (systemd-tmpfiles, TMPDIR cleaner daemons) for icat runs","Retry the icat invocation; transient races usually clear"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if _, err := os.Stat(frameFile); err != nil { /* regenerate frame before transmit */ }","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"Failed to open image data output file\") { /* regenerate and retry once */ }","preventionTips":["Keep temp dirs free of concurrent cleanup","Retry transient file-open failures once"],"tags":["kitty","icat","shm","filesystem"],"backgroundTag":"file-open-failed","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}