{"record":{"id":"d708f1138ad334e0","repo":"siyuan-note/siyuan","slug":"load-tree-failed","errorCode":null,"errorMessage":"load tree failed: ","messagePattern":"load tree failed: ","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/api/block_op.go","lineNumber":61,"sourceCode":"\tif util.InvalidIDPattern(input.ID, ret) {\n\t\treturn input, false\n\t}\n\treturn input, true\n}\n\nfunc buildUpdatedTaskListItemBlockDOM(id, marker string, luteEngine *lute.Lute) (data string, err error) {\n\tblock, err := model.GetBlock(id, nil)\n\tif err != nil {\n\t\treturn \"\", errors.New(\"get block failed: \" + err.Error())\n\t}\n\n\tif \"NodeListItem\" != block.Type {\n\t\treturn \"\", errors.New(\"block is not a list item\")\n\t}\n\n\ttree, err := filesys.LoadTree(block.Box, block.Path, luteEngine)\n\tif err != nil {\n\t\treturn \"\", errors.New(\"load tree failed: \" + err.Error())\n\t}\n\n\tli := treenode.GetNodeInTree(tree, id)\n\tif li == nil {\n\t\treturn \"\", errors.New(\"block not found\")\n\t}\n\n\tif 3 != li.ListData.Typ {\n\t\treturn \"\", errors.New(\"block is not a task list item\")\n\t}\n\n\tif 1 != len(marker) {\n\t\treturn \"\", errors.New(\"task list item marker length should be 1\")\n\t}\n\n\tliMarker := marker[0]\n\tif '[' == liMarker || ']' == liMarker {\n\t\treturn \"\", errors.New(\"task list item marker can not be [ or ]\")","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/api/block_op.go#L43-L79","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Reindex the notebook so block.Path matches the actual .sy file location","Verify the file exists at workspace/data/<box>/<path> and is valid JSON (.sy)","Retry after sync completes; resolve sync conflicts that renamed documents","Restore the file from snapshot/history if it was removed externally"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await toggle(id); } catch (e) { if (String(e).includes(\"load tree failed\")) await sleep(500), retryOnce(); }","preventionTips":["Avoid manual edits to .sy files under data/","Let sync finish before editing","Reindex notebooks after external file changes"],"tags":["go","file-read","tree-load","task-list"],"backgroundTag":"file-read-failed","analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}