{"record":{"id":"c665d11095eac5ab","repo":"siyuan-note/siyuan","slug":"empty-result","errorCode":null,"errorMessage":"empty result","messagePattern":"empty result","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/mcp/tools/block.go","lineNumber":406,"sourceCode":"\t}\n\treturn CallToolResult{Content: []ContentItem{{Type: \"text\", Text: \"block deleted: \" + id}}}, nil\n}\n\nfunc getBlockData(args map[string]any) (data, dataType string) {\n\tdata, _ = args[\"data\"].(string)\n\tdataType, _ = args[\"dataType\"].(string)\n\tif dataType == \"\" {\n\t\tdataType = \"markdown\"\n\t}\n\treturn\n}\n\nfunc markdownToBlockDOM(md string) (string, error) {\n\tluteEngine := util.NewLute()\n\tluteEngine.SetHTMLTag2TextMark(true)\n\tresult, _ := luteEngine.Md2BlockDOMTree(md, true)\n\tif result == \"\" {\n\t\treturn \"\", fmt.Errorf(\"empty result\")\n\t}\n\treturn result, nil\n}\n\nfunc blockMove(args map[string]any) (CallToolResult, error) {\n\tid, _ := args[\"id\"].(string)\n\tif id == \"\" {\n\t\treturn CallToolResult{Content: []ContentItem{{Type: \"text\", Text: \"id is required\"}}, IsError: true}, nil\n\t}\n\tparentID, _ := args[\"parentID\"].(string)\n\tif parentID == \"\" {\n\t\treturn CallToolResult{Content: []ContentItem{{Type: \"text\", Text: \"parentID is required\"}}, IsError: true}, nil\n\t}\n\tpreviousID, _ := args[\"previousID\"].(string)\n\tboxID, release, scopeErr := beginBlockToolScope(args, true, id, parentID, previousID)\n\tif scopeErr != nil {\n\t\treturn blockToolError(scopeErr.Error())\n\t}","sourceCodeStart":388,"sourceCodeEnd":424,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/mcp/tools/block.go#L388-L424","documentation":"`markdownToBlockDOM` ran the input through `luteEngine.Md2BlockDOMTree` and the resulting block DOM string was empty, meaning Lute produced no blocks. SiYuan cannot insert a block from empty DOM, so it surfaces this error rather than writing nothing.","triggerScenarios":"Passing markdown that yields no block — an empty string, only whitespace, only front-matter/comment syntax that Lute discards, or content consisting entirely of elements Lute strips (e.g. raw HTML comments, lone link definitions).","commonSituations":"Calling `create-block`-style tools with `markdown: \"\"` or `markdown: \"   \"`. Sending a snippet that is only a YAML front-matter block or only reference-style link definitions, which do not become visible blocks.","solutions":["Provide non-empty markdown that contains at least one renderable block (a heading, paragraph, list item, etc.).","Strip pure-metadata constructs (front matter, lone link definitions) before sending if they are the only content.","Validate the input on the caller side: reject empty/whitespace-only `markdown` before invoking the tool."],"exampleFix":"// before\n{\"markdown\": \"\"}\n// after\n{\"markdown\": \"# Hello world\"}","handlingStrategy":"validation","validationCode":"// Reject empty/whitespace markdown before calling create-block.\nif strings.TrimSpace(markdown) == \"\" {\n    return errors.New(\"markdown must contain at least one renderable block\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure markdown contains at least one visible block (paragraph, heading, list).","Strip pure front-matter/link-definition-only content before sending.","Validate non-empty content on the caller side."],"tags":["mcp","block","lute","markdown","input-validation"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}