siyuan-note/siyuan · error
empty result
Error message
empty result
What it means
`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.
Source
Thrown at kernel/mcp/tools/block.go:406
}
return CallToolResult{Content: []ContentItem{{Type: "text", Text: "block deleted: " + id}}}, nil
}
func getBlockData(args map[string]any) (data, dataType string) {
data, _ = args["data"].(string)
dataType, _ = args["dataType"].(string)
if dataType == "" {
dataType = "markdown"
}
return
}
func markdownToBlockDOM(md string) (string, error) {
luteEngine := util.NewLute()
luteEngine.SetHTMLTag2TextMark(true)
result, _ := luteEngine.Md2BlockDOMTree(md, true)
if result == "" {
return "", fmt.Errorf("empty result")
}
return result, nil
}
func blockMove(args map[string]any) (CallToolResult, error) {
id, _ := args["id"].(string)
if id == "" {
return CallToolResult{Content: []ContentItem{{Type: "text", Text: "id is required"}}, IsError: true}, nil
}
parentID, _ := args["parentID"].(string)
if parentID == "" {
return CallToolResult{Content: []ContentItem{{Type: "text", Text: "parentID is required"}}, IsError: true}, nil
}
previousID, _ := args["previousID"].(string)
boxID, release, scopeErr := beginBlockToolScope(args, true, id, parentID, previousID)
if scopeErr != nil {
return blockToolError(scopeErr.Error())
}View on GitHub (pinned to 251596fc0d)
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.
Example fix
// before
{"markdown": ""}
// after
{"markdown": "# Hello world"} Defensive patterns
Strategy: validation
Validate before calling
// Reject empty/whitespace markdown before calling create-block.
if strings.TrimSpace(markdown) == "" {
return errors.New("markdown must contain at least one renderable block")
} Prevention
- 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.
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- invalid tool arguments: %w
- name must end in .html or .htm
- encrypted notebook is locked, please unlock it first
- path is required
- path escapes templates dir: %s
AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12).
Data as JSON: /api/errors/c665d11095eac5ab.
Report an issue: GitHub.