siyuan-note/siyuan · warning

attribute view group not found

Error message

attribute view group not found

What it means

The kernel validates that every group ID present in the live view also exists as a key in the submitted RowOrder.Groups map. If any live group is missing from the payload, the submitted order cannot describe the current view, so the commit is rejected with this error.

Source

Thrown at kernel/model/attribute_view_row_sort.go:239

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
		}
		collection := collections[*change.ValidateGroup]
		if nil == collection {
			return av.ErrViewNotFound
		}

View on GitHub (pinned to 8641553a1f)

Solutions

  1. Rebuild the RowOrder payload so its Groups map contains an entry for every current view group, then retry
  2. Reload the view and re-perform the drag against its current grouping
  3. Check payload construction code to include empty/new groups, not just groups visible at preview time

Example fix

// before
for _, g := range previewGroups {
    rowOrder.Groups[g.ID] = g.Order
}
// after
for _, g := range view.Groups { // all live groups, including new ones
    rowOrder.Groups[g.ID] = groupOrderFor(g)
}
Defensive patterns

Strategy: validation

Validate before calling

const groupIds = getViewGroups(avID, viewID).map(g => g.id);
const missing = groupIds.filter(id => !(id in payload.RowOrder.Groups));
if (missing.length > 0) {
  missing.forEach(id => payload.RowOrder.Groups[id] = defaultOrder());
}

Prevention

When it happens

Trigger: Calling sortAttributeViewRow with a RowOrder payload whose Groups map lacks an entry for one of the view's current groups — partial payloads built from stale views, groups added between preview and commit, or payload construction bugs omitting empty groups.

Common situations: A new group appeared because a row's grouping key value changed before commit; a payload builder that only serializes non-empty groups; concurrent group edits from another client.

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@8641553a1f (2026-09-11). Data as JSON: /api/errors/f340660fc17c51ee. Report an issue: GitHub.