{"record":{"id":"d9bd4493844d7fc4","repo":"siyuan-note/siyuan","slug":"attribute-view-s-template-plan-not-found","errorCode":null,"errorMessage":"attribute view [%s] template plan not found","messagePattern":"attribute view \\[(.+?)\\] template plan not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/template.go","lineNumber":900,"sourceCode":"\n\t\tif (ast.NodeListItem == n.Type && (nil == n.FirstChild ||\n\t\t\t(3 == n.ListData.Typ && (nil == n.FirstChild.Next || ast.NodeKramdownBlockIAL == n.FirstChild.Next.Type)))) ||\n\t\t\t(ast.NodeBlockquote == n.Type && nil != n.FirstChild && nil != n.FirstChild.Next && ast.NodeKramdownBlockIAL == n.FirstChild.Next.Type) ||\n\t\t\t(ast.NodeCallout == n.Type && nil != n.FirstChild && ast.NodeKramdownBlockIAL == n.FirstChild.Type) {\n\t\t\tnodesNeedAppendChild = append(nodesNeedAppendChild, n)\n\t\t}\n\n\t\tif n.IsTextMarkType(\"inline-math\") {\n\t\t\tif n.ParentIs(ast.NodeTableCell) {\n\t\t\t\t// 表格中的公式中带有管道符时使用 HTML 实体替换管道符 Improve the handling of inline-math containing `|` in the table https://github.com/siyuan-note/siyuan/issues/9227\n\t\t\t\tn.TextMarkInlineMathContent = strings.ReplaceAll(n.TextMarkInlineMathContent, \"|\", \"&#124;\")\n\t\t\t}\n\t\t}\n\n\t\tif ast.NodeAttributeView == n.Type {\n\t\t\tplan := attributeViewPlans[n]\n\t\t\tif nil == plan {\n\t\t\t\terr = fmt.Errorf(\"attribute view [%s] template plan not found\", n.AttributeViewID)\n\t\t\t\treturn ast.WalkStop\n\t\t\t}\n\t\t\tappliedView, applyErr := applyTemplateAttributeViewPlan(n, plan)\n\t\t\tif nil != applyErr {\n\t\t\t\terr = applyErr\n\t\t\t\treturn ast.WalkStop\n\t\t\t}\n\t\t\tif preview && nil != appliedView {\n\t\t\t\ttemplateAttributeViewPreviewTable(n, plan)\n\t\t\t\tunlinks = append(unlinks, n)\n\t\t\t}\n\t\t}\n\n\t\treturn ast.WalkContinue\n\t})\n\tif nil != err {\n\t\treturn\n\t}","sourceCodeStart":882,"sourceCodeEnd":918,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/model/template.go#L882-L918","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := renderTemplate(p); err != nil {\n    if strings.Contains(err.Error(), \"template plan not found\") {\n        // internal invariant: report with template content + kernel version\n        return fmt.Errorf(\"internal error rendering %s (kernel %s): %w\", p, util.Ver, err)\n    }\n    return err\n}","preventionTips":["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"],"tags":["template","attribute-view","internal-error"],"backgroundTag":"internal-invariant-violation","analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}