siyuan-note/siyuan · warning

attribute view rows changed; retry the drag

Error message

attribute view rows changed; retry the drag

What it means

During a row-drag move, moveAttributeViewSortedRows partitions the current ordered row list into moved (selected) and remaining rows. If the number of moved rows found in the ordered list differs from the number of selected IDs, some selected rows no longer exist in the current order — the view changed underneath the drag. The kernel rejects the stale operation and tells the client to retry the drag.

Solutions

  1. Re-fetch the current view state and have the user repeat the drag.
  2. Verify no concurrent editor deleted the selected rows between preview and drop.
  3. Refresh filters/sorts so the selected rows are present in the rendered view, then retry.
  4. Make the client discard the stale RowOrder payload and recompute it from the fresh view.
Defensive patterns

Strategy: retry

Try / catch

try {
  await commitRowDrag(payload);
} catch (e) {
  if (String(e.msg).includes("rows changed; retry")) {
    const fresh = await fetchAttributeView(avID);
    rebuildDragPayload(fresh); // then let the user retry
  }
}

Prevention

When it happens

Trigger: Dragging rows where one or more selected row IDs are absent from the current ordered view: rows deleted by another client/session between preview and drop, rows filtered out by changed filter/sort conditions, or a stale preview computed against an older snapshot.

Common situations: Two browser windows open on the same database, one deleting rows while the other drags; a filter change mid-drag; a plugin mutating the attribute view while the user drags; replaying an old drag payload after sync updated the 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/b6b3d4bdeb9774ad. Report an issue: GitHub.

Appendix: source

Thrown at kernel/model/attribute_view_row_sort.go:187

func moveAttributeViewSortedRows(ordered, selected []string, previousID, nextID string) ([]string, error) {
	selectedIDs := map[string]bool{}
	for _, id := range selected {
		selectedIDs[id] = true
	}
	if 0 == len(selectedIDs) {
		return nil, errors.New("no attribute view rows selected")
	}
	var moved, remaining []string
	for _, id := range ordered {
		if selectedIDs[id] {
			moved = append(moved, id)
		} else {
			remaining = append(remaining, id)
		}
	}
	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...)

View on GitHub (pinned to 9f775e8a12)