{"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":5649,"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":5631,"sourceCodeEnd":5667,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/attribute_view.go#L5631-L5667","documentation":"resolveAttributeViewCarrierBoxID looks up the tree of the block that carries a database (the carrier block). If getAttributeViewCarrierBlockTree returns nil — the block ID cannot be found in any open notebook — the resolver fails with this error, since it cannot determine which notebook (box) the database belongs to.","triggerScenarios":"An operation that needs the carrier box for a database block (e.g. resolving storage paths for the attribute view) is given a blockID that is empty-adjacent garbage, was deleted, belongs to a closed notebook, or was never indexed.","commonSituations":"The carrier block was removed before the call; the notebook is closed or not loaded; a stale ID from history/sync is used; a plugin passes a document-level ID where a block ID is required.","solutions":["Confirm the carrier block still exists (search its ID in the workspace and in SQL) and that its notebook is open","Re-fetch the correct block ID from the database's block-key values or the document","Reload/reindex the notebook if the tree cache is stale","If the block was intentionally deleted, delete or rebind the database instead of resolving its carrier"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const block = await sqlQuery('SELECT * FROM blocks WHERE id = ?', blockID);\nif (!block) throw new Error(`carrier block ${blockID} missing`);","typeGuard":"function hasCarrier(blockID) { return typeof blockID === 'string' && blockID.length > 0 && blockIndex.has(blockID); }","tryCatchPattern":"try {\n  const boxID = await api.resolveCarrierBox(blockID);\n} catch (e) {\n  if (/carrier: block \\[.+\\] not found/.test(e.message)) {\n    await reloadNotebookAndReindex();\n    // or re-derive blockID from the av's block-key values\n  } else { throw e; }\n}","preventionTips":["Ensure the target notebook is open before database operations","Re-derive carrier block IDs from the database's block values instead of caches","Handle deleted blocks by cleaning up or rebinding the database"],"tags":["attribute-view","block","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"}