siyuan-note/siyuan · error
database blocks are not supported by createDocTree templates
Error message
database blocks are not supported by createDocTree templates
What it means
createDocTree-style template rendering refuses to process a template whose parsed tree contains an attribute view (database) block. Database blocks have no plain-markdown rendering semantics in this code path, so rendering is aborted instead of producing a silently incomplete document tree. The check runs after parsing the template markdown via parseTemplateKTree and before walking nodes.
Source
Thrown at kernel/model/template_doc_tree_render.go:264
contains := false
ast.Walk(tree.Root, func(node *ast.Node, entering bool) ast.WalkStatus {
if entering && ast.NodeAttributeView == node.Type {
contains = true
return ast.WalkStop
}
return ast.WalkContinue
})
return contains
}
func renderTemplateDocTreeMarkdown(markdown []byte, boxID string) (*parse.Tree, error) {
tree, err := parseTemplateKTree(markdown)
if err != nil {
return nil, err
}
tree.Box = boxID
if templateTreeContainsAttributeView(tree) {
return nil, errors.New("database blocks are not supported by createDocTree templates")
}
var nodesNeedAppendChild, unlinks []*ast.Node
blockIDs := map[string]string{}
ast.Walk(tree.Root, func(node *ast.Node, entering bool) ast.WalkStatus {
if !entering {
return ast.WalkContinue
}
if "" != node.ID {
oldID := node.ID
node.ID = ast.NewNodeID()
blockIDs[oldID] = node.ID
node.SetIALAttr("id", node.ID)
node.RemoveIALAttr(av.NodeAttrNameAvs)
treenode.RefreshUpdated(node)
}
if (ast.NodeListItem == node.Type && (nil == node.FirstChild ||View on GitHub (pinned to 8641553a1f)
Solutions
- Remove the database/attribute-view block from the template markdown before rendering
- Use a template without database blocks for createDocTree rendering
- Render through a path that supports database blocks instead of the createDocTree template renderer
Example fix
// before: template.md contains a database block -> render fails // after: strip the database block markdown = removeDatabaseBlocks(markdown) tree, err := renderTemplateDocTreeMarkdown(markdown, boxID, ...)
Defensive patterns
Strategy: validation
Validate before calling
func hasDatabaseBlock(markdown []byte) bool {
engine := model.NewLute()
tree := parse.Parse("", markdown, engine.ParseOptions)
return tree != nil && model.TemplateTreeContainsAttributeView(tree)
}
// call renderTemplateDocTreeMarkdown only if !hasDatabaseBlock(md) Prevention
- Keep createDocTree templates free of database/attribute-view blocks
- Check templates with templateTreeContainsAttributeView before rendering
- Regenerate templates from documents without embedded databases
When it happens
Trigger: renderTemplateDocTreeMarkdown is called with markdown containing a database/attribute-view block (e.g. a template saved from a document that embeds an attribute view); templateTreeContainsAttributeView returns true and the error is returned to the createDocTree template renderer.
Common situations: Users save a document that contains a database block as a template and then use it in a createDocTree flow; templates copied from other documents with embedded databases; older templates that gained database blocks after an upgrade.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- template packages cannot be renamed or moved
- Parse template failed: %s
- parse tree [%s] failed
- database [%s] template field [%s] rendering failed: %s
- ErrSpecTooNew
AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11).
Data as JSON: /api/errors/9230cb488be08100.
Report an issue: GitHub.