{"record":{"id":"894de6cb723538a2","repo":"siyuan-note/siyuan","slug":"attribute-view-s-visible-view-s-not-found","errorCode":null,"errorMessage":"attribute view [%s] visible view [%s] not found","messagePattern":"attribute view \\[(.+?)\\] visible view \\[(.+?)\\] not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/template.go","lineNumber":513,"sourceCode":"\t\t\treturn nil, fmt.Errorf(\"attribute view [%s] view [%s] not found\", attrView.ID, viewID)\n\t\t}\n\t} else if selectedView, err = attrView.GetFirstView(); nil != err {\n\t\treturn nil, fmt.Errorf(\"attribute view [%s] has no available view: %w\", attrView.ID, err)\n\t}\n\n\tvisibleViewIDs := strings.TrimSpace(node.IALAttr(av.NodeAttrVisibleViewIDs))\n\tif \"\" == visibleViewIDs {\n\t\treturn\n\t}\n\tvisibleViewCount := 0\n\tfor _, visibleViewID := range strings.Split(visibleViewIDs, \",\") {\n\t\tvisibleViewID = strings.TrimSpace(visibleViewID)\n\t\tif \"\" == visibleViewID {\n\t\t\tcontinue\n\t\t}\n\t\tvisibleViewCount++\n\t\tif nil == attrView.GetView(visibleViewID) {\n\t\t\treturn nil, fmt.Errorf(\"attribute view [%s] visible view [%s] not found\", attrView.ID, visibleViewID)\n\t\t}\n\t}\n\tif 1 > visibleViewCount {\n\t\treturn nil, fmt.Errorf(\"attribute view [%s] has no available visible view\", attrView.ID)\n\t}\n\treturn\n}\n\nfunc resolveCopyTemplateAttributeView(node *ast.Node, attrView *av.AttributeView) *av.View {\n\tif viewID := strings.TrimSpace(node.IALAttr(av.NodeAttrView)); \"\" != viewID {\n\t\tif view := attrView.GetView(viewID); nil != view {\n\t\t\treturn view\n\t\t}\n\t}\n\tview, _ := attrView.GetFirstView()\n\treturn view\n}\n","sourceCodeStart":495,"sourceCodeEnd":531,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/model/template.go#L495-L531","documentation":"If the template node sets the visible-view-ids IAL (av.NodeAttrVisibleViewIDs), each listed view ID must exist in the attribute view. This error reports the first visible-view ID that no longer resolves — typically a view deleted after the template captured its visible-view list.","triggerScenarios":"Instantiating a template whose database block lists visible view IDs, one of which was deleted or renamed in the source attribute view.","commonSituations":"Templates exported before views were deleted, hand-edited visible-view-ID lists, or databases merged or modified after the template was saved.","solutions":["Re-save the template from a document whose database still has all listed visible views","Edit the template custom-av-visible-view-ids attribute to list only existing view IDs","Remove the custom-av-visible-view-ids attribute so default view behavior applies"],"exampleFix":"// before (database block IAL in template)\n{: custom-av-visible-view-ids='20240101-a,20240102-deleted'}\n// after\n{: custom-av-visible-view-ids='20240101-a'}","handlingStrategy":"validation","validationCode":"for _, id := range strings.Split(node.IALAttr('custom-av-visible-view-ids'), ',') {\n    if id = strings.TrimSpace(id); id != '' && attrView.GetView(id) == nil {\n        // prune the stale ID before validation\n    }\n}","typeGuard":"func allVisibleViewsExist(attrView *av.AttributeView, ids string) bool {\n    for _, id := range strings.Split(ids, ',') {\n        if id = strings.TrimSpace(id); id != '' && attrView.GetView(id) == nil {\n            return false\n        }\n    }\n    return true\n}","tryCatchPattern":"if _, err := validateTemplateAttributeViewNode(node, attrView); err != nil {\n    if strings.Contains(err.Error(), 'visible view') {\n        return fmt.Errorf('template references deleted view: %w', err)\n    }\n    return err\n}","preventionTips":["Update visible-view lists whenever views are deleted in databases used by templates","Prefer omitting custom-av-visible-view-ids when unsure","Re-export templates after any database restructuring"],"tags":["go","attribute-view","template","reference"],"backgroundTag":"resource-not-found","analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}