{"record":{"id":"7cf78ebcaaa6507e","repo":"siyuan-note/siyuan","slug":"attribute-view-s-is-not-bound","errorCode":null,"errorMessage":"attribute view [%s] is not bound","messagePattern":"attribute view \\[(.+?)\\] is not bound","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/attribute_view.go","lineNumber":8597,"sourceCode":"\t}\n\treturn\n}\n\nfunc sortAttrViewBindingIDs(avIDs []string, avID, previousAvID string) (ret []string, err error) {\n\tret = append([]string(nil), avIDs...)\n\tif avID == previousAvID {\n\t\treturn\n\t}\n\n\tindex := -1\n\tfor i, id := range ret {\n\t\tif id == avID {\n\t\t\tindex = i\n\t\t\tbreak\n\t\t}\n\t}\n\tif 0 > index {\n\t\treturn nil, fmt.Errorf(\"attribute view [%s] is not bound\", avID)\n\t}\n\n\tret = append(ret[:index], ret[index+1:]...)\n\tpreviousIndex := -1\n\tif \"\" != previousAvID {\n\t\tfor i, id := range ret {\n\t\t\tif id == previousAvID {\n\t\t\t\tpreviousIndex = i\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif 0 > previousIndex {\n\t\t\treturn nil, fmt.Errorf(\"previous attribute view [%s] is not bound\", previousAvID)\n\t\t}\n\t}\n\n\tret = util.InsertElem(ret, previousIndex+1, avID)\n\treturn","sourceCodeStart":8579,"sourceCodeEnd":8615,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/attribute_view.go#L8579-L8615","documentation":"When reordering bound attribute views (e.g. detaching or moving a view within a block's bound-views list), the kernel searches the current binding list for the given avID. If the attribute view is not actually bound to that block, it cannot be unbound/reordered and this error is returned.","triggerScenarios":"Calling the unbind/move attribute view API with operation.AvID that is not present in the block's bound attribute view ID list; operating on a stale avID after the view was already unbound or the block deleted.","commonSituations":"Plugin holding an outdated list of bound views; double-invocation of an unbind action; copying an avID from a different block; view deleted in another client between fetch and call.","solutions":["Re-fetch the block's bound attribute views and confirm the avID is in the list before unbinding/moving","Use the correct avID for the target block","Make the unbind operation idempotent: skip the call when the view is already absent","Refresh UI state after any unbind so stale IDs are not reused"],"exampleFix":"// before\nawait fetchPost(\"/api/av/removeAttributeView\", {avID: staleAvID, blockID})\n// after\nconst bound = await getBoundAvIDs(blockID);\nif (bound.includes(avID)) await fetchPost(\"/api/av/removeAttributeView\", {avID, blockID});","handlingStrategy":"validation","validationCode":"const bound = await getBoundAvIDs(blockID);\nif (!bound.includes(avID)) throw new Error(`attribute view ${avID} is not bound to ${blockID}`);","typeGuard":null,"tryCatchPattern":"try { await unbindAttributeView({avID, blockID}); } catch (e) { if (String(e).includes(\"is not bound\")) { /* treat as already unbound; refresh state */ } else { throw e; } }","preventionTips":["Refresh bound-view lists after every unbind/delete operation","Make unbind calls idempotent by pre-checking the binding list","Avoid caching avIDs across sessions"],"tags":["attribute-view","binding","not-found"],"backgroundTag":"entity-not-found","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}