kovidgoyal/kitty · error

terminal asked for drag data from URI list with out of bound

Error message

terminal asked for drag data from URI list with out of bounds index: %d

What it means

The terminal requested an entry of the remote uri-list by index, but the index is negative or >= len(uri_list). The drag is finished with EINVAL and the error returned.

Source

Thrown at kittens/dnd/drag.go:492

			return err
		}
		dnd.drag_status.current_remote_file = x
		if err = dnd.send_next_file_chunk(); err != nil {
			return err
		}
	}
	return
}

func (dnd *dnd) on_drag_remote_data_request(idx int) (err error) {
	ds := dnd.drag_sources["text/uri-list"]
	if ds == nil || len(ds.uri_list) < 1 {
		dnd.finish_drag("EINVAL")
		return fmt.Errorf("terminal asked for drag data from URI list but no list present")
	}
	if idx < 0 || idx >= len(ds.uri_list) {
		dnd.finish_drag("EINVAL")
		return fmt.Errorf("terminal asked for drag data from URI list with out of bounds index: %d", idx)
	}
	ds.uri_list[idx].was_sent = true
	dnd.drag_status.remote_data_requests = append(dnd.drag_status.remote_data_requests, idx)
	if len(dnd.drag_status.remote_data_requests) == 1 {
		err = dnd.send_next_remote_data_request()
	}
	return
}

func (dnd *dnd) send_next_remote_data_request() (err error) {
	if len(dnd.drag_status.remote_data_requests) == 0 {
		return nil
	}
	i := dnd.drag_status.remote_data_requests[0]
	x := dnd.drag_sources["text/uri-list"].uri_list[i]
	items := []*remote_data_item{}
	if x.metadata.IsDir() {
		if children, err := dnd.send_remote_dir(x.path, i, 0, i); err != nil {

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Ensure the files being dragged still exist for the whole drag duration
  2. Update kitty so both sides agree on the uri-list length
  3. Report with debug logs if reproducible with matching versions
Defensive patterns

Strategy: validation

Validate before calling

// Verify files still exist right before the drag starts
for _, f := range files { if _, err := os.Stat(f); err != nil { return err } }

Prevention

When it happens

Trigger: on_drag_remote_data_request(idx) with idx outside the uri_list built from the command-line file arguments — protocol desync or malformed index from the terminal.

Common situations: Kitten/terminal version mismatch, or the number of dragged files changed between advertisement and request (e.g. files deleted mid-drag).

Related errors


AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27). Data as JSON: /api/errors/75021edbf824e57a. Report an issue: GitHub.