siyuan-note/siyuan · error

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

Error message

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

What it means

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.

Source

Thrown at kernel/model/attribute_view.go:5624

	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 8641553a1f)

Solutions

  1. Verify the blockID exists (query the blocks table / get block by ID) before calling the API
  2. Open or refresh indexing of the notebook that should contain the block
  3. If the block was deleted, recreate it or use a valid carrier block ID

Example fix

// before
resolveCarrierBoxID(maybeDeletedId);
// after
const block = await sql("SELECT * FROM blocks WHERE id = ?", id);
if (block) resolveCarrierBoxID(id);
Defensive patterns

Strategy: validation

Validate before calling

const hit = await sql("SELECT id FROM blocks WHERE id = ?", [blockID]);
if (!hit.length) throw new Error(`carrier block ${blockID} missing`);

Try / catch

try { await resolveCarrier(blockID); } catch (e) { if (String(e).includes("not found")) await refreshIndexThenRetry(); else throw e; }

Prevention

When it happens

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

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

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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