siyuan-note/siyuan · warning

attribute view groups changed; retry the drag

Error message

attribute view groups changed; retry the drag

What it means

applyAttributeViewRowOrder also validates group structure: the submitted RowOrder.Groups map must cover exactly the same number of groups as the view currently has. If the counts differ (groups added, removed, or regrouped since the preview), the order payload is stale or structurally wrong, so the commit fails with this error and the client must retry the drag against the fresh view.

Solutions

  1. Re-render the attribute view, rebuild the RowOrder payload for the current groups, and redo the drag.
  2. Check whether the group-by field value changed during the drag and account for the new grouping before committing.
  3. Avoid holding a preview open while group-affecting edits are possible; commit promptly or refresh first.
  4. If a plugin constructs RowOrder, generate its Groups map from the live view.Groups rather than a cached copy.
Defensive patterns

Strategy: retry

Validate before calling

if (Object.keys(payload.rowOrder?.groups ?? {}).length !== currentView.groups.length) {
  // stale group structure: re-render and rebuild the payload before committing
}

Try / catch

try {
  await applyAttributeViewRowOrder(payload);
} catch (e) {
  if (String(e.msg).includes("groups changed; retry")) {
    const fresh = await fetchAttributeView(avID);
    payload.rowOrder.groups = buildGroupsMap(fresh);
    // retry the reorder on the fresh grouping
  }
}

Prevention

When it happens

Trigger: Committing a drag on a grouped attribute view after a cell value changed such that a row regrouped (group count changed), after another session added/removed a group, or when the client built RowOrder.Groups against an older grouping.

Common situations: Group-by views where editing a grouping field during/after the drag moves the row between groups; collaborative sessions where one user changes the group-by configuration while another drags; stale previews held open across a sync that regrouped rows.

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/35240382b3663575. Report an issue: GitHub.

Appendix: source

Thrown at kernel/model/attribute_view_row_sort.go:239

	}
	return ret
}

func applyAttributeViewRowOrder(attrView *av.AttributeView, view *av.View, data any) error {
	encoded, err := gulu.JSON.MarshalJSON(data)
	if nil != err {
		return err
	}
	var change attributeViewRowOrderChange
	if err = gulu.JSON.UnmarshalJSON(encoded, &change); nil != err {
		return err
	}
	if nil == change.RowOrder || nil == change.Expected ||
		!reflect.DeepEqual(getAttributeViewRowOrder(view), change.Expected) {
		return errors.New("attribute view order changed; retry the drag")
	}
	if len(change.RowOrder.Groups) != len(view.Groups) {
		return errors.New("attribute view groups changed; retry the drag")
	}
	for _, group := range view.Groups {
		if _, ok := change.RowOrder.Groups[group.ID]; !ok {
			return errors.New("attribute view group not found")
		}
	}
	if nil != change.ValidateGroup && len(change.RowOrder.Sorts) > 0 {
		// 预览之后字段值可能变化,提交时再次校验,不能悄悄接受冲突的落点。
		copyView, copyErr := cloneAttributeViewRowSort(attrView)
		if nil != copyErr {
			return copyErr
		}
		candidate := copyView.GetView(view.ID)
		setAttributeViewRowOrder(candidate, change.RowOrder)
		collections, renderErr := renderAttributeViewRowSortCollections(copyView, candidate, false)
		if nil != renderErr {
			return renderErr
		}

View on GitHub (pinned to 9f775e8a12)