{"record":{"id":"bd2a7b43e405381b","repo":"siyuan-note/siyuan","slug":"previous-attribute-view-s-is-not-bound","errorCode":null,"errorMessage":"previous attribute view [%s] is not bound","messagePattern":"previous attribute view \\[(.+?)\\] is not bound","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/attribute_view.go","lineNumber":8610,"sourceCode":"\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\n}\n\nfunc bindBlockAv(tx *Transaction, avID, blockID string) {\n\tnode, tree, err := getNodeByBlockID(tx, blockID)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tbindBlockAv0(tx, avID, node, tree)\n\treturn\n}\n\nfunc bindBlockAv0(tx *Transaction, avID string, node *ast.Node, tree *parse.Tree) {","sourceCodeStart":8592,"sourceCodeEnd":8628,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/attribute_view.go#L8592-L8628","documentation":"When inserting/moving an attribute view to a position after a 'previous' view, the kernel verifies that previousAvID is itself bound to the block. If the previous view ID is not found in the binding list, the insertion point is invalid and this error is returned.","triggerScenarios":"Calling the bind/insert attribute view API with operation.PreviousAvID referencing a view that is not bound to the block (wrong ID, already unbound, or belongs to another block).","commonSituations":"Plugin computing insertion position from a cached list; passing empty-vs-wrong previousAvID handling mixed up; UI drag-and-drop sending a stale drop-target ID.","solutions":["Verify previousAvID exists in the block's current bound-views list before inserting","Omit previousAvID (or use the appropriate append mode) when inserting at the end","Re-fetch the binding list after any unbind/delete to refresh drop targets","Fix the drop-target computation so it only offers currently bound views"],"exampleFix":"// before\nawait fetchPost(\"/api/av/bindAttributeView\", {avID, blockID, previousAvID: stalePrevID})\n// after\nconst bound = await getBoundAvIDs(blockID);\nconst previousAvID = bound.includes(stalePrevID) ? stalePrevID : \"\"; // or pick a valid one\nawait fetchPost(\"/api/av/bindAttributeView\", {avID, blockID, previousAvID})","handlingStrategy":"validation","validationCode":"const bound = await getBoundAvIDs(blockID);\nif (previousAvID && !bound.includes(previousAvID)) throw new Error(`previous view ${previousAvID} is not bound`);","typeGuard":null,"tryCatchPattern":"try { await bindAttributeView({avID, blockID, previousAvID}); } catch (e) { if (String(e).includes(\"previous attribute view\")) { retryWithoutPrevious(); } else { throw e; } }","preventionTips":["Compute insertion targets only from the live bound-views list","Clear stale drop-target state on view unbind/delete","Fall back to append (no previousAvID) when the target is missing"],"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"}