kovidgoyal/kitty · error
terminal asked for drag data from MIME list with out of boun
Error message
terminal asked for drag data from MIME list with out of bounds index: %d
What it means
During a drag operation the terminal requested drag data by index into the offered MIME list, but the index is negative or >= len(offered_mimes). The kitten aborts the drag with finish_drag("EINVAL") and returns this error.
Source
Thrown at kittens/dnd/drag.go:274
return err
}
}
return dnd.render_screen()
}
func (dnd *dnd) finish_drag(errname string) {
if errname == "" { // cancel drag
dnd.lp.QueueDnDData(DC{Type: 'E', Y: -1})
} else {
dnd.lp.QueueDnDData(DC{Type: 'E', Payload: []byte(errname)})
}
dnd.reset_drag()
}
func (dnd *dnd) handle_data_request(idx int) (err error) {
if idx < 0 || idx >= len(dnd.drag_status.offered_mimes) {
dnd.finish_drag("EINVAL")
return fmt.Errorf("terminal asked for drag data from MIME list with out of bounds index: %d", idx)
}
mime := dnd.drag_status.offered_mimes[idx]
ds := dnd.drag_sources[mime]
for _, dr := range dnd.drag_status.data_requests {
if dr.index == idx {
dnd.finish_drag("EINVAL")
return fmt.Errorf("terminal sent a duplicate drag data request")
}
}
dr := &data_request{drag_source: ds, index: idx}
if ds.path == "" {
dnd.lp.QueueDnDData(DC{Type: 'e', Y: idx, Payload: utils.UnsafeStringToBytes(base64.RawStdEncoding.EncodeToString(ds.data))})
dnd.lp.QueueDnDData(DC{Type: 'e', Y: idx}) // EOF
return
} else {
if ds.file != nil {
ds.file.Close()
}View on GitHub (pinned to 6d5d0c4406)
Solutions
- Ensure kitten and kitty terminal come from the same installation/version
- Update kitty — index desync is a protocol bug fixed in newer releases
- Reproduce with --debug-input and report upstream if persistent
Defensive patterns
Strategy: validation
Validate before calling
// Before starting the drag, assert the offered list is non-empty and stable:
if len(dnd.drag_status.offered_mimes) == 0 { return errors.New("no MIMEs offered") } Prevention
- Use matching kitten/terminal versions
- Do not mutate the offered MIME list mid-drag
When it happens
Trigger: handle_data_request(idx) is invoked from on_drag_event with an index outside the range of mimes advertised when the drag started — caused by a protocol bug or a desynchronized MIME list between kitten and terminal.
Common situations: Version mismatch between the kitten and terminal implementations of the DnD protocol; race where the MIME list changed mid-drag; malformed escape sequence decoding the index.
Related errors
- terminal responded with drag source error: %s
- terminal sent a duplicate drag data request
- terminal asked for drag data from URI list but no list prese
- terminal asked for drag data from URI list with out of bound
- This kitten should be run as: kitten quick-access-terminal
AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27).
Data as JSON: /api/errors/85a0ecac662971db.
Report an issue: GitHub.