siyuan-note/siyuan · error

resolve attribute view carrier: block

Error message

resolve attribute view carrier: block [%s] not found

What it means

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.

Solutions

  1. Confirm the carrier block still exists (search its ID in the workspace and in SQL) and that its notebook is open
  2. Re-fetch the correct block ID from the database's block-key values or the document
  3. Reload/reindex the notebook if the tree cache is stale
  4. If the block was intentionally deleted, delete or rebind the database instead of resolving its carrier
Defensive patterns

Strategy: try-catch

Validate before calling

const block = await sqlQuery('SELECT * FROM blocks WHERE id = ?', blockID);
if (!block) throw new Error(`carrier block ${blockID} missing`);

Type guard

function hasCarrier(blockID) { return typeof blockID === 'string' && blockID.length > 0 && blockIndex.has(blockID); }

Try / catch

try {
  const boxID = await api.resolveCarrierBox(blockID);
} catch (e) {
  if (/carrier: block \[.+\] not found/.test(e.message)) {
    await reloadNotebookAndReindex();
    // or re-derive blockID from the av's block-key values
  } else { throw e; }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/93b1a96d4512356f. Report an issue: GitHub.

Appendix: source

Thrown at kernel/model/attribute_view.go:5649

	blockTree := treenode.GetBlockTree(blockID)
	if nil != blockTree {
		return blockTree
	}
	for _, encBoxID := range treenode.GetOpenedEncryptedBoxIDs() {
		if blockTree = treenode.GetBlockTreeInBox(blockID, encBoxID); nil != blockTree {
			return blockTree
		}
	}
	return nil
}

func resolveAttributeViewCarrierBoxID(blockID string) (boxID string, exact bool, err error) {
	if "" == blockID {
		return "", false, nil
	}
	blockTree := getAttributeViewCarrierBlockTree(blockID)
	if nil == blockTree {
		return "", true, fmt.Errorf("resolve attribute view carrier: block [%s] not found", blockID)
	}
	if IsEncryptedBox(blockTree.BoxID) {
		return blockTree.BoxID, true, nil
	}
	return "", true, nil
}

// SetAttrViewFilters 用新的过滤规则数组整体替换指定视图的过滤规则,并持久化。
// data 为 JSON 反序列化前的 []any(通常是前端传来的过滤节点树)。
func SetAttrViewFilters(avID, blockID string, data []any) (err error) {
	attrView, err := avParseView(avID, blockID)
	if err != nil {
		return
	}

	view, err := getAttrViewViewByBlockID(attrView, blockID)
	if err != nil {
		return

View on GitHub (pinned to 9f775e8a12)