{"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":985,"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":967,"sourceCodeEnd":1003,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/template.go#L967-L1003","documentation":"During the apply phase of template rendering, every attribute view node in the parsed tree must have a matching plan prepared in the earlier planning walk. If attributeViewPlans has no entry for a node, the tree and plan phase are inconsistent and the walk stops with this error naming the node's AttributeViewID. This is an internal invariant: planTemplateAttributeViews should have registered a plan (even a degenerate one) for every av node.","triggerScenarios":"rendering a tree where an ast.NodeAttributeView was not visited (or a different tree instance's node map) during planning — e.g. nodes injected after planning, walking a different root, or plan map keyed by node pointers that no longer match after tree mutation.","commonSituations":"Kernel bug or regression after tree rewriting between plan and apply; custom code paths that modify the parsed tree between the two walks; node identity changed because the tree was re-parsed.","solutions":["Re-run the render; if transient it indicates a race between planning and applying.","Verify the attribute view ID on the offending block matches a real block in the template source.","If reproducible, file a bug with the template: this signals the planner skipped the node (check templateAttributeViewMode validation and earlier error paths that returned WalkStop)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"template plan not found\") {\n    // planner/apply mismatch; re-render once before surfacing\n    return renderTemplateWithMode(id, mode)\n}","preventionTips":["Do not mutate the parsed tree between planning and applying","Report persistent occurrences as kernel bugs with the offending template attached"],"tags":["go","template","attribute-view","invariant"],"backgroundTag":"internal-invariant-violation","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}