{"record":{"id":"93b1a96d4512356f","repo":"siyuan-note/siyuan","slug":"resolve-attribute-view-carrier-block-s-not-fou","errorCode":null,"errorMessage":"resolve attribute view carrier: block [%s] not found","messagePattern":"resolve attribute view carrier: block \\[(.+?)\\] not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/attribute_view.go","lineNumber":5624,"sourceCode":"\tblockTree := treenode.GetBlockTree(blockID)\n\tif nil != blockTree {\n\t\treturn blockTree\n\t}\n\tfor _, encBoxID := range treenode.GetOpenedEncryptedBoxIDs() {\n\t\tif blockTree = treenode.GetBlockTreeInBox(blockID, encBoxID); nil != blockTree {\n\t\t\treturn blockTree\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc resolveAttributeViewCarrierBoxID(blockID string) (boxID string, exact bool, err error) {\n\tif \"\" == blockID {\n\t\treturn \"\", false, nil\n\t}\n\tblockTree := getAttributeViewCarrierBlockTree(blockID)\n\tif nil == blockTree {\n\t\treturn \"\", true, fmt.Errorf(\"resolve attribute view carrier: block [%s] not found\", blockID)\n\t}\n\tif IsEncryptedBox(blockTree.BoxID) {\n\t\treturn blockTree.BoxID, true, nil\n\t}\n\treturn \"\", true, nil\n}\n\n// SetAttrViewFilters 用新的过滤规则数组整体替换指定视图的过滤规则，并持久化。\n// data 为 JSON 反序列化前的 []any（通常是前端传来的过滤节点树）。\nfunc SetAttrViewFilters(avID, blockID string, data []any) (err error) {\n\tattrView, err := avParseView(avID, blockID)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tview, err := getAttrViewViewByBlockID(attrView, blockID)\n\tif err != nil {\n\t\treturn","sourceCodeStart":5606,"sourceCodeEnd":5642,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/model/attribute_view.go#L5606-L5642","documentation":"Returned by resolveAttributeViewCarrierBoxID when the block acting as an attribute-view carrier cannot be found: getAttributeViewCarrierBlockTree returns nil for the given blockID, so no tree containing that block exists in any open notebook. An empty blockID is tolerated (returns no error, exact=false); a non-empty but unknown ID is an error.","triggerScenarios":"Calling APIs that resolve the carrier notebook of a database block with a blockID that does not exist on disk (no matching .sy block) — deleted block, wrong ID, or the notebook is not opened/indexed yet.","commonSituations":"Stale IDs cached before the block was deleted; typo'd or truncated block IDs; the notebook was just created/renamed and the index has not caught up; unopened notebook referenced directly.","solutions":["Verify the blockID exists (query the blocks table / get block by ID) before calling the API","Open or refresh indexing of the notebook that should contain the block","If the block was deleted, recreate it or use a valid carrier block ID"],"exampleFix":"// before\nresolveCarrierBoxID(maybeDeletedId);\n// after\nconst block = await sql(\"SELECT * FROM blocks WHERE id = ?\", id);\nif (block) resolveCarrierBoxID(id);","handlingStrategy":"validation","validationCode":"const hit = await sql(\"SELECT id FROM blocks WHERE id = ?\", [blockID]);\nif (!hit.length) throw new Error(`carrier block ${blockID} missing`);","typeGuard":null,"tryCatchPattern":"try { await resolveCarrier(blockID); } catch (e) { if (String(e).includes(\"not found\")) await refreshIndexThenRetry(); else throw e; }","preventionTips":["Check block existence via the blocks table first","Allow empty blockID where the API permits it","Ensure target notebooks are opened and indexed"],"tags":["attribute-view","block-not-found","indexing"],"backgroundTag":"resource-not-found","analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}