{"record":{"id":"59f3086ebd696d92","repo":"siyuan-note/siyuan","slug":"data-block-dom-failed-w","errorCode":null,"errorMessage":"data block DOM failed: %w","messagePattern":"data block DOM failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/block_update.go","lineNumber":209,"sourceCode":"\t\t\t\tinvalidID = n.ID\n\t\t\t\treturn ast.WalkStop\n\t\t\t}\n\t\t\treturn ast.WalkContinue\n\t\t})\n\t}\n\tif \"\" != invalidID {\n\t\treturn \"\", errors.New(\"found invalid ID [\" + invalidID + \"]\")\n\t}\n\treturn\n}\n\nfunc parseBlockUpdateData(data, dataType string, luteEngine *lute.Lute) (ret string, tree *parse.Tree, err error) {\n\tret = data\n\tswitch dataType {\n\tcase \"markdown\":\n\t\tret, err = DataBlockDOM(data, luteEngine)\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"data block DOM failed: %w\", err)\n\t\t\treturn\n\t\t}\n\tcase \"dom\":\n\tdefault:\n\t\terr = fmt.Errorf(\"unsupported block data type [%s]\", dataType)\n\t\treturn\n\t}\n\n\ttree = luteEngine.BlockDOM2Tree(ret)\n\tif nil == tree || nil == tree.Root || nil == firstContentBlock(tree.Root) {\n\t\terr = errors.New(\"parse tree failed\")\n\t}\n\treturn\n}\n\nfunc normalizeBlockUpdateTree(oldNode *ast.Node, tree *parse.Tree, luteEngine *lute.Lute) (ret *parse.Tree, updatedNode *ast.Node, err error) {\n\tupdatedNode, err = resolveBlockUpdateNode(oldNode, tree.Root)\n\tif err != nil {","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/model/block_update.go#L191-L227","documentation":"Returned by parseBlockUpdateData when dataType == \"markdown\" and DataBlockDOM(data, luteEngine) returned a non-nil error. The wrapped error (%w) carries the underlying Lute/parse cause. The input could not be converted from markdown to the SiYuan DOM representation.","triggerScenarios":"Malformed markdown (unbalanced code fences, broken inline math, unsupported syntax); very large input that exceeds Lute limits; encoding issues (non-UTF-8 bytes).","commonSituations":"Pasted markdown from a tool that emits non-standard syntax; programmatic generation producing half-formed markdown; encoding mismatch in the transport layer.","solutions":["Inspect the wrapped error for the specific Lute parse message.","Reduce the input to a minimal repro and isolate the offending markdown fragment.","Sanitize/normalize the markdown (e.g. via a linter) before submission.","If the input is already DOM, switch dataType to \"dom\" to skip the markdown-to-DOM step."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// minimal sanity check on markdown before sending\nif strings.Count(md, \"```\")%2 != 0 {\n    return errors.New(\"unbalanced code fences\")\n}","typeGuard":null,"tryCatchPattern":"ops, roots, err := buildBlockUpdateOperations(inputs, resolver, loader)\nif err != nil {\n    if cause := errors.Unwrap(err); cause != nil && strings.Contains(cause.Error(), \"markdown\") {\n        // narrow to minimal repro and surface cause to user\n    }\n}","preventionTips":["Normalize markdown through a linter before submission.","Reduce large inputs to isolate offending fragments.","Prefer dom input when you already have rendered HTML, to skip the markdown parse."],"tags":["block-update","markdown","lute","parse"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}