siyuan-note/siyuan · warning

attribute view drop target changed; retry the drag

Error message

attribute view drop target changed; retry the drag

What it means

After extracting the remaining (unselected) rows, moveAttributeViewSortedRows locates the drop target: nextID (or previousID when dropping at the end) must still exist in the remaining list. If neither anchor row is found (index < 0), the drop target row vanished or moved out of the remaining set since the drag started, so the move is rejected and the client is told to retry.

Solutions

  1. Re-read the current row order and retry the drag with fresh anchor IDs.
  2. Check that nextID/previousID refer to rows present in the current (non-selected) view rows.
  3. Discard the stale drag operation in the client and recompute anchors from the latest render.
  4. Avoid applying drags after any view mutation (filter, sort, delete) without first refreshing the preview.
Defensive patterns

Strategy: retry

Validate before calling

const remaining = currentRowIds.filter(id => !selected.includes(id));
if ((nextID && !remaining.includes(nextID)) || (!nextID && previousID && !remaining.includes(previousID))) {
  // anchors stale: refresh the view before submitting
}

Try / catch

try {
  await commitRowDrag(payload);
} catch (e) {
  if (String(e.msg).includes("drop target changed")) {
    await refreshView(); // recompute nextID/previousID from the fresh render
  }
}

Prevention

When it happens

Trigger: Dropping rows whose nextID/previousID anchor was deleted or itself moved (e.g. it was part of another concurrent drag) between when the drag order was captured and when the move is applied; passing an anchor ID that is one of the selected rows in a mismatched way; sending empty anchors when the previous logic expected one.

Common situations: Collaborative editing where another user removes the row you dropped next to; a UI that cached neighbor row IDs before a filter/sort change; automated tests replaying recorded drags against a mutated view.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/0258198c8d21b1eb. Report an issue: GitHub.

Appendix: source

Thrown at kernel/model/attribute_view_row_sort.go:202

		}
	}
	if len(moved) != len(selectedIDs) {
		return nil, errors.New("attribute view rows changed; retry the drag")
	}
	if selectedIDs[nextID] || ("" == nextID && selectedIDs[previousID]) {
		return slices.Clone(ordered), nil
	}
	index := 0
	if "" != nextID {
		index = slices.Index(remaining, nextID)
	} else if "" != previousID {
		index = slices.Index(remaining, previousID)
		if index >= 0 {
			index++
		}
	}
	if index < 0 {
		return nil, errors.New("attribute view drop target changed; retry the drag")
	}
	ret := append([]string{}, remaining[:index]...)
	ret = append(ret, moved...)
	return append(ret, remaining[index:]...), nil
}

// mergeAttributeViewRowOrder 保留当前尚未参与渲染的项目 ID,避免用页面数据覆盖完整列表。
func mergeAttributeViewRowOrder(original, ordered []string) []string {
	ret := append([]string{}, ordered...)
	seen := map[string]bool{}
	for _, id := range ordered {
		seen[id] = true
	}
	for _, id := range original {
		if !seen[id] {
			ret = append(ret, id)
			seen[id] = true
		}

View on GitHub (pinned to 9f775e8a12)