siyuan-note/siyuan · error
parse attribute view rich text failed
Error message
parse attribute view rich text failed
What it means
The lute engine finished Md2BlockDOMTree on the kramdown content but produced a nil tree or a nil root, meaning the rich text content could not be parsed into a block DOM AST at all. Unlike per-node validation errors, this signals total parse failure — lute returned no usable tree for the given content string.
Solutions
- Ensure Content is non-empty, valid kramdown before calling the parse APIs
- Inspect the content string for unbalanced kramdown IAL ({: style="..."}) or HTML/text-mark constructs and fix them
- Re-open the attribute view value in the SiYuan editor and re-save so the kernel re-serializes the content from the DOM
- If the data is corrupted by sync, restore the affected document from file history or sync snapshots
Example fix
// before
rich := &av.ValueTextRich{Spec: av.ValueTextRichSpec, Format: av.ValueTextRichFormatKramdown, Content: ""}
// after
if strings.TrimSpace(content) == "" { content = "placeholder" }
rich := &av.ValueTextRich{Spec: av.ValueTextRichSpec, Format: av.ValueTextRichFormatKramdown, Content: content} Defensive patterns
Strategy: try-catch
Validate before calling
if strings.TrimSpace(content) == "" { content = "" } // treat empty as no rich text: set Rich=nil instead Try / catch
_, err := av.ParseValueTextRich(rich); if err != nil && strings.Contains(err.Error(), "parse attribute view rich text failed") { fallbackPlain := value.Text; /* fall back to plain text rendering */ } Prevention
- Never persist hand-spliced kramdown; let the editor serialize content
- Keep content non-empty or set Rich to nil for plain values
- After failed writes/sync, verify attribute view content parses before reuse
- Test with lute Md2BlockDOMTree directly when generating content programmatically
When it happens
Trigger: Calling ParseValueTextRich / ParseTableCellRich / normalizeValueTextRichTreeSourceWithImages with content so malformed that lute.Md2BlockDOMTree returns nil or a tree without Root (nil/empty content edge cases, deeply corrupted markup after entity protection).
Common situations: Passing an empty or whitespace-only Content string; corrupted rich text from a crashed sync; programmatically spliced content where the kramdown IAL markers are unbalanced.
Related errors
- attribute view rich text normalization did not converge
- attribute view rich text style entity sentinel was not…
- attribute view rich text style entity was not restored
- attribute view rich text tree is missing
- encoded style entity is not attached to an attribute view…
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/e2dde3e2ec83e27e.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/av/value.go:581
}
if ValueTextRichSpec != rich.Spec {
err = fmt.Errorf("unsupported attribute view rich text spec [%d]", rich.Spec)
return
}
if ValueTextRichFormatKramdown != rich.Format {
err = fmt.Errorf("unsupported attribute view rich text format [%s]", rich.Format)
return
}
luteEngine := newValueTextRichLute()
content, protectedStyleEntities, protectErr := protectValueTextRichKramdownStyleEntities(rich.Content)
if nil != protectErr {
err = protectErr
return
}
blockDOM, tree = luteEngine.Md2BlockDOMTree(content, true)
if nil == tree || nil == tree.Root {
err = fmt.Errorf("parse attribute view rich text failed")
return
}
if 0 < len(protectedStyleEntities) {
if err = restoreValueTextRichTreeStyleEntities(tree, protectedStyleEntities); nil != err {
return
}
blockDOM = luteEngine.Tree2BlockDOM(tree, luteEngine.RenderOptions, luteEngine.ParseOptions)
}
err = validateValueTextRichTreeWithImages(tree, images)
return
}
func validateValueTextRichTree(tree *parse.Tree) (err error) {
return validateValueTextRichTreeWithImages(tree, false)
}
func validateValueTextRichTreeWithImages(tree *parse.Tree, images bool) (err error) {
if nil == tree || nil == tree.Root {View on GitHub (pinned to 9f775e8a12)