{"record":{"id":"f340660fc17c51ee","repo":"siyuan-note/siyuan","slug":"attribute-view-group-not-found","errorCode":null,"errorMessage":"attribute view group not found","messagePattern":"attribute view group not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"kernel/model/attribute_view_row_sort.go","lineNumber":239,"sourceCode":"func applyAttributeViewRowOrder(attrView *av.AttributeView, view *av.View, data any) error {\n\tencoded, err := gulu.JSON.MarshalJSON(data)\n\tif nil != err {\n\t\treturn err\n\t}\n\tvar change attributeViewRowOrderChange\n\tif err = gulu.JSON.UnmarshalJSON(encoded, &change); nil != err {\n\t\treturn err\n\t}\n\tif nil == change.RowOrder || nil == change.Expected ||\n\t\t!reflect.DeepEqual(getAttributeViewRowOrder(view), change.Expected) {\n\t\treturn errors.New(\"attribute view order changed; retry the drag\")\n\t}\n\tif len(change.RowOrder.Groups) != len(view.Groups) {\n\t\treturn errors.New(\"attribute view groups changed; retry the drag\")\n\t}\n\tfor _, group := range view.Groups {\n\t\tif _, ok := change.RowOrder.Groups[group.ID]; !ok {\n\t\t\treturn errors.New(\"attribute view group not found\")\n\t\t}\n\t}\n\tif nil != change.ValidateGroup && len(change.RowOrder.Sorts) > 0 {\n\t\t// 预览之后字段值可能变化，提交时再次校验，不能悄悄接受冲突的落点。\n\t\tcopyView, copyErr := cloneAttributeViewRowSort(attrView)\n\t\tif nil != copyErr {\n\t\t\treturn copyErr\n\t\t}\n\t\tcandidate := copyView.GetView(view.ID)\n\t\tsetAttributeViewRowOrder(candidate, change.RowOrder)\n\t\tcollections, renderErr := renderAttributeViewRowSortCollections(copyView, candidate, false)\n\t\tif nil != renderErr {\n\t\t\treturn renderErr\n\t\t}\n\t\tcollection := collections[*change.ValidateGroup]\n\t\tif nil == collection {\n\t\t\treturn av.ErrViewNotFound\n\t\t}","sourceCodeStart":221,"sourceCodeEnd":257,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/model/attribute_view_row_sort.go#L221-L257","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Rebuild the RowOrder payload so its Groups map contains an entry for every current view group, then retry","Reload the view and re-perform the drag against its current grouping","Check payload construction code to include empty/new groups, not just groups visible at preview time"],"exampleFix":"// before\nfor _, g := range previewGroups {\n    rowOrder.Groups[g.ID] = g.Order\n}\n// after\nfor _, g := range view.Groups { // all live groups, including new ones\n    rowOrder.Groups[g.ID] = groupOrderFor(g)\n}","handlingStrategy":"validation","validationCode":"const groupIds = getViewGroups(avID, viewID).map(g => g.id);\nconst missing = groupIds.filter(id => !(id in payload.RowOrder.Groups));\nif (missing.length > 0) {\n  missing.forEach(id => payload.RowOrder.Groups[id] = defaultOrder());\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Serialize an entry for every live group, including empty ones","Build payloads from the full view model, not just visible groups","Rebuild the payload whenever groups are added between preview and commit"],"tags":["attribute-view","row-sort","groups","payload"],"backgroundTag":"invalid-state-transition","analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}