{"record":{"id":"362d24e6f5a4285a","repo":"siyuan-note/siyuan","slug":"load-tree-failed-s","errorCode":null,"errorMessage":"load tree failed: %s","messagePattern":"load tree failed: (.+?)","errorType":"validation","errorClass":null,"httpStatus":200,"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/afa823b6b4e4f183511e0bc0a3be93caa94c7c97/kernel/api/block_op.go#L43-L79","documentation":"Third failure mode of buildUpdatedTaskListItemBlockDOM (kernel/api/block_op.go): the block was found in the index and is a list item, but filesys.LoadTree failed to load the .sy document file for block.Box/block.Path. The underlying filesystem error is appended to the prefix, so the message tells you whether it was a missing file, permission problem, or parse failure.","triggerScenarios":"The .sy file was deleted, moved, or renamed on disk while its index entry survived (unmounted notebook, external file manipulation, interrupted sync); the notebook containing the block is closed/unmounted between index read and tree load; the .sy file is corrupted and cannot be parsed; filesystem permission or disk errors.","commonSituations":"Sync tool rewrote the notebook directory mid-call; user closed the notebook in another window; .sy files edited by external scripts or merged badly; antivirus/locking software blocking reads on Windows.","solutions":["Check the notebook is mounted and the .sy file exists on disk at the path reported in the block info","Remount/reopen the notebook and retry the update","If the file is missing but content matters, recover from history (.siyuan/history or /api/history/) or the data repo","Rebuild the index so stale entries pointing at gone files are cleaned up; inspect the appended underlying error in the kernel log"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const info = await fetchPost('/api/block/getBlockInfo', { id });\nconst nb = await fetchGet('/api/notebook/lsNotebooks');\nconst mounted = nb.data.notebooks.some(n => n.id === info.data.box && !n.closed);\nif (!mounted) throw new Error('notebook not mounted; open it before updating');\nawait fetchPost('/api/block/updateTaskListItemMarker', { id, marker });","typeGuard":"const isMountedNotebook = (boxId: string, notebooks: { id: string; closed: boolean }[]): boolean =>\n  notebooks.some(n => n.id === boxId && !n.closed);","tryCatchPattern":"if (/^load tree failed:/.test(e.message)) {\n  // underlying fs error: check .sy exists on disk, remount notebook, or reindex; retry after fix\n}","preventionTips":["Do not close/unmount notebooks while automated block updates run","Let external tools write .sy files only through the kernel, never alongside it","On load failures, verify the file on disk before retrying blindly"],"tags":["block","filesystem","tree","sync","siyuan"],"backgroundTag":"file-load-failed","analyzedSha":"afa823b6b4e4f183511e0bc0a3be93caa94c7c97","analyzedAt":"2026-08-18T17:04:10.865Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}