{"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":597,"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":579,"sourceCodeEnd":615,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/template.go#L579-L615","documentation":"If the attribute-view node carries a `custom-visible-view-ids` IAL listing which views the rendered block may show, each listed ID must exist in the attribute view. The first missing ID aborts validation with this error naming the attribute view and the unknown visible-view ID. This keeps rendered templates from silently dropping configured visible views.","triggerScenarios":"A template node's `custom-visible-view-ids` (comma-separated, av.NodeAttrVisibleViewIDs) contains an ID that attrView.GetView cannot resolve — typically a stale ID left after the view was deleted or the list was edited by hand. Raised during template rendering via prepareTemplateAttributeViews.","commonSituations":"Hand-editing the visible-view list, deleting views in the UI while a template still lists them, or syncing templates between workspaces where view IDs differ.","solutions":["Remove the stale ID from custom-visible-view-ids or replace it with an existing view ID","Remove the whole custom-visible-view-ids attribute so no visibility filtering is applied","Verify each comma-separated ID against the database's current views in the UI","Regenerate the template from a workspace where the database and its views exist"],"exampleFix":"<!-- before -->\n<div custom-visible-view-ids=\"20240101120000-gone,20240101120001-ok\" ...></div>\n<!-- after -->\n<div custom-visible-view-ids=\"20240101120001-ok\" ...></div>","handlingStrategy":"validation","validationCode":"const av = await getAttrView(avID);\nconst ids = (attrs[\"custom-visible-view-ids\"] || \"\").split(\",\").map(s => s.trim()).filter(Boolean);\nconst bad = ids.filter(id => !av.views.some(v => v.id === id));\nif (bad.length) await setBlockAttrs(blockID, {\"custom-visible-view-ids\": ids.filter(id => !bad.includes(id)).join(\",\")});","typeGuard":null,"tryCatchPattern":"try {\n  await insertTemplate(path);\n} catch (e) {\n  if (String(e).includes(\"visible view [\").includes(\"not found\")) {\n    await dropStaleVisibleViewIDs(blockID); // rewrite list, retry\n  }\n}","preventionTips":["Update custom-visible-view-ids whenever views are deleted","Only list view IDs that currently exist in the target database","Avoid editing visible-view lists by hand; change visibility in the UI"],"tags":["attribute-view","template","not-found"],"backgroundTag":"entity-not-found","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"}