siyuan-note/siyuan · error

load tree failed:

Error message

load tree failed: 

What it means

buildUpdatedTaskListItemBlockDOM loads the enclosing .sy document with filesys.LoadTree; any read/parse failure is wrapped as "load tree failed: <reason>". This means the document file for the block could not be read from the workspace or parsed as a valid tree by Lute.

Source

Thrown at kernel/api/block_op.go:61

	if util.InvalidIDPattern(input.ID, ret) {
		return input, false
	}
	return input, true
}

func buildUpdatedTaskListItemBlockDOM(id, marker string, luteEngine *lute.Lute) (data string, err error) {
	block, err := model.GetBlock(id, nil)
	if err != nil {
		return "", errors.New("get block failed: " + err.Error())
	}

	if "NodeListItem" != block.Type {
		return "", errors.New("block is not a list item")
	}

	tree, err := filesys.LoadTree(block.Box, block.Path, luteEngine)
	if err != nil {
		return "", errors.New("load tree failed: " + err.Error())
	}

	li := treenode.GetNodeInTree(tree, id)
	if li == nil {
		return "", errors.New("block not found")
	}

	if 3 != li.ListData.Typ {
		return "", errors.New("block is not a task list item")
	}

	if 1 != len(marker) {
		return "", errors.New("task list item marker length should be 1")
	}

	liMarker := marker[0]
	if '[' == liMarker || ']' == liMarker {
		return "", errors.New("task list item marker can not be [ or ]")

View on GitHub (pinned to 8641553a1f)

Solutions

  1. Reindex the notebook so block.Path matches the actual .sy file location
  2. Verify the file exists at workspace/data/<box>/<path> and is valid JSON (.sy)
  3. Retry after sync completes; resolve sync conflicts that renamed documents
  4. Restore the file from snapshot/history if it was removed externally
Defensive patterns

Strategy: retry

Try / catch

try { await toggle(id); } catch (e) { if (String(e).includes("load tree failed")) await sleep(500), retryOnce(); }

Prevention

When it happens

Trigger: filesys.LoadTree(block.Box, block.Path, luteEngine) fails: the .sy file was deleted or moved after indexing, the box/path from the stale blocktree record no longer matches disk, file lock contention, or a corrupt .sy file.

Common situations: Sync race left the index pointing at a removed .sy file; user manually edited/deleted files under data/<box>/; disk I/O error or locked file on network drives; encrypted notebook state changed between GetBlock and LoadTree.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


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