siyuan-note/siyuan · error
attribute view [%s] template plan not found
Error message
attribute view [%s] template plan not found
What it means
During the AST walk in renderTemplateSource, each NodeAttributeView in the rendered tree must have a prepared plan in the attributeViewPlans map built by prepareTemplateAttributeViews. If a database block lacks a plan — an internal bookkeeping invariant — the walk stops with this error. It indicates the prepare step and the apply step disagree about which database nodes exist.
Source
Thrown at kernel/model/template.go:900
if (ast.NodeListItem == n.Type && (nil == n.FirstChild ||
(3 == n.ListData.Typ && (nil == n.FirstChild.Next || ast.NodeKramdownBlockIAL == n.FirstChild.Next.Type)))) ||
(ast.NodeBlockquote == n.Type && nil != n.FirstChild && nil != n.FirstChild.Next && ast.NodeKramdownBlockIAL == n.FirstChild.Next.Type) ||
(ast.NodeCallout == n.Type && nil != n.FirstChild && ast.NodeKramdownBlockIAL == n.FirstChild.Type) {
nodesNeedAppendChild = append(nodesNeedAppendChild, n)
}
if n.IsTextMarkType("inline-math") {
if n.ParentIs(ast.NodeTableCell) {
// 表格中的公式中带有管道符时使用 HTML 实体替换管道符 Improve the handling of inline-math containing `|` in the table https://github.com/siyuan-note/siyuan/issues/9227
n.TextMarkInlineMathContent = strings.ReplaceAll(n.TextMarkInlineMathContent, "|", "|")
}
}
if ast.NodeAttributeView == n.Type {
plan := attributeViewPlans[n]
if nil == plan {
err = fmt.Errorf("attribute view [%s] template plan not found", n.AttributeViewID)
return ast.WalkStop
}
appliedView, applyErr := applyTemplateAttributeViewPlan(n, plan)
if nil != applyErr {
err = applyErr
return ast.WalkStop
}
if preview && nil != appliedView {
templateAttributeViewPreviewTable(n, plan)
unlinks = append(unlinks, n)
}
}
return ast.WalkContinue
})
if nil != err {
return
}View on GitHub (pinned to 8641553a1f)
Solutions
- Update SiYuan to the latest version — this is an internal invariant violation usually fixed upstream.
- Simplify the template: remove unusual database-block placements (inside tabs/embeds) and retry.
- Reproduce with a minimal template and report it to siyuan-note/siyuan with the template content and logs.
Defensive patterns
Strategy: try-catch
Try / catch
if err := renderTemplate(p); err != nil {
if strings.Contains(err.Error(), "template plan not found") {
// internal invariant: report with template content + kernel version
return fmt.Errorf("internal error rendering %s (kernel %s): %w", p, util.Ver, err)
}
return err
} Prevention
- Keep SiYuan updated; this is an internal consistency error
- Avoid exotic database-block placements (inside embeds/tabs) in templates
- Report reproducible cases to siyuan-note/siyuan with a minimal template
When it happens
Trigger: Calling RenderTemplateWithMode or PreviewTemplateSource with a tree containing a NodeAttributeView whose node pointer was not keyed by prepareTemplateAttributeViews (e.g. an attribute-view node introduced after prepare, or an edge case in tree rewriting that replaced the node).
Common situations: Kernel version mismatch or a bug after tree surgery; templates where ID rewriting or node unlinking mutates the tree between prepare and walk; custom-built trees passed to the render pipeline.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- database [%s] template field [%s] rendering failed: %s
- parse template [%s] failed: %s
- execute template [%s] failed: %s
- relation value is missing
- unsupported value type [%s]
AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11).
Data as JSON: /api/errors/d9bd4493844d7fc4.
Report an issue: GitHub.