{"record":{"id":"75021edbf824e57a","repo":"kovidgoyal/kitty","slug":"terminal-asked-for-drag-data-from-uri-list-with-ou","errorCode":null,"errorMessage":"terminal asked for drag data from URI list with out of bounds index: %d","messagePattern":"terminal asked for drag data from URI list with out of bounds index: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kittens/dnd/drag.go","lineNumber":492,"sourceCode":"\t\t\treturn err\n\t\t}\n\t\tdnd.drag_status.current_remote_file = x\n\t\tif err = dnd.send_next_file_chunk(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn\n}\n\nfunc (dnd *dnd) on_drag_remote_data_request(idx int) (err error) {\n\tds := dnd.drag_sources[\"text/uri-list\"]\n\tif ds == nil || len(ds.uri_list) < 1 {\n\t\tdnd.finish_drag(\"EINVAL\")\n\t\treturn fmt.Errorf(\"terminal asked for drag data from URI list but no list present\")\n\t}\n\tif idx < 0 || idx >= len(ds.uri_list) {\n\t\tdnd.finish_drag(\"EINVAL\")\n\t\treturn fmt.Errorf(\"terminal asked for drag data from URI list with out of bounds index: %d\", idx)\n\t}\n\tds.uri_list[idx].was_sent = true\n\tdnd.drag_status.remote_data_requests = append(dnd.drag_status.remote_data_requests, idx)\n\tif len(dnd.drag_status.remote_data_requests) == 1 {\n\t\terr = dnd.send_next_remote_data_request()\n\t}\n\treturn\n}\n\nfunc (dnd *dnd) send_next_remote_data_request() (err error) {\n\tif len(dnd.drag_status.remote_data_requests) == 0 {\n\t\treturn nil\n\t}\n\ti := dnd.drag_status.remote_data_requests[0]\n\tx := dnd.drag_sources[\"text/uri-list\"].uri_list[i]\n\titems := []*remote_data_item{}\n\tif x.metadata.IsDir() {\n\t\tif children, err := dnd.send_remote_dir(x.path, i, 0, i); err != nil {","sourceCodeStart":474,"sourceCodeEnd":510,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kittens/dnd/drag.go#L474-L510","documentation":"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.","triggerScenarios":"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.","commonSituations":"Kitten/terminal version mismatch, or the number of dragged files changed between advertisement and request (e.g. files deleted mid-drag).","solutions":["Ensure the files being dragged still exist for the whole drag duration","Update kitty so both sides agree on the uri-list length","Report with debug logs if reproducible with matching versions"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Verify files still exist right before the drag starts\nfor _, f := range files { if _, err := os.Stat(f); err != nil { return err } }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure dragged files persist for the entire drag duration","Keep kitten/terminal versions matched"],"tags":["dnd","drag-and-drop","index-out-of-bounds","uri-list"],"backgroundTag":"index-out-of-bounds","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}