siyuan-note/siyuan · error
load tree failed:
Error message
load tree failed:
What it means
After the block type check, the function loads the containing .sy document via filesys.LoadTree; failure (missing/corrupt file, IO error) is wrapped as 'load tree failed: ...' with the cause appended. The block row exists in the index but its source document cannot be parsed.
Solutions
- Restore or re-sync the missing/corrupt .sy file (check 历史/history or cloud sync)
- Rebuild the index so stale block rows pointing at deleted docs are purged
- Check file system permissions on data/<box>/**
Defensive patterns
Strategy: try-catch
Validate before calling
// check the source doc file exists before block ops
const doc = await fetchPost('/api/filetree/getDoc', {id});
if (!doc.data) throw new Error('doc missing'); Try / catch
try { await updateTaskItem(id) } catch (e) { if (String(e).includes('load tree failed')) await rebuildIndexAndRetry(id) } Prevention
- Keep sync interruptions rare; verify data integrity after crash/sync
- Restore .sy files from history instead of continuing on corrupt docs
- Run 重建索引 when block rows and files diverge
When it happens
Trigger: model.GetBlock succeeded but the .sy file on disk is missing, unreadable, or unparseable (corrupted JSON, partial sync write, file deleted between index and load).
Common situations: Docs deleted while the SQL index still references them; interrupted sync leaving truncated .sy files; permissions problems in the workspace data dir.
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
- agent runtime session id mismatch
- cannot read pinned document
- code block has no code node
- database back relation value is invalid
- database history contains an invalid field
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/d708f1138ad334e0.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/api/block_op.go:46
"github.com/siyuan-note/siyuan/kernel/filesys"
"github.com/siyuan-note/siyuan/kernel/model"
"github.com/siyuan-note/siyuan/kernel/treenode"
"github.com/siyuan-note/siyuan/kernel/util"
)
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 9f775e8a12)