kovidgoyal/kitty · error
Failed to seek in image data output file: %s with error: %w
Error message
Failed to seek in image data output file: %s with error: %w
What it means
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.
Source
Thrown at kittens/icat/transmit.go:95
if frame.compose_onto > 0 {
gc.SetOverlaidFrame(uint64(frame.compose_onto))
}
gc.SetLeftEdge(uint64(frame.left)).SetTopEdge(uint64(frame.top))
}
return gc
}
func transmit_shm(imgd *image_data, frame_num int, frame *image_frame) (err error) {
var mmap shm.MMap
var data_size int64
if frame.in_memory_bytes == nil {
f, err := os.Open(frame.filename)
if err != nil {
return fmt.Errorf("Failed to open image data output file: %s with error: %w", frame.filename, err)
}
defer f.Close()
if data_size, err = f.Seek(0, io.SeekEnd); err != nil {
return fmt.Errorf("Failed to seek in image data output file: %s with error: %w", frame.filename, err)
}
if _, err = f.Seek(0, io.SeekStart); err != nil {
return fmt.Errorf("Failed to seek in image data output file: %s with error: %w", frame.filename, err)
}
if mmap, err = shm.CreateTemp("icat-*", uint64(data_size)); err != nil {
return fmt.Errorf("Failed to create a SHM file for transmission: %w", err)
}
if _, err = io.ReadFull(f, mmap.Slice()); err != nil {
mmap.Close()
mmap.Unlink()
return fmt.Errorf("Failed to read data from image output data file: %w", err)
}
} else {
data_size = int64(len(frame.in_memory_bytes))
if mmap, err = shm.CreateTemp("icat-*", uint64(data_size)); err != nil {
return fmt.Errorf("Failed to create a SHM file for transmission: %w", err)
}
copy(mmap.Slice(), frame.in_memory_bytes)View on GitHub (pinned to 6d5d0c4406)
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
Defensive patterns
Strategy: retry
Validate before calling
if fi, err := os.Stat(f); err != nil || !fi.Mode().IsRegular() { /* reject pipes/special files */ } Try / catch
if err != nil && strings.Contains(err.Error(), "Failed to seek") { /* retry with fresh file handle */ } Prevention
- Only use regular files for frame data
- Avoid FIFOs as image sources
When it happens
Trigger: 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.
Common situations: frame.filename pointing at a FIFO or special file; concurrent truncation; failing disk/NFS mount.
Related errors
- Failed to open image data output file: %s with error: %w
- Failed to read data from image output data file: %w
- Failed to create a SHM file for transmission: %w
- Failed to convert image data output file: %s to absolute pat
- Failed to write image data to temp file for transmission: %w
AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27).
Data as JSON: /api/errors/d2bf4157cfba14ac.
Report an issue: GitHub.