{"record":{"id":"8cf20e638ddd5a05","repo":"siyuan-note/siyuan","slug":"attribute-view-s-not-found-in-box-s","errorCode":null,"errorMessage":"attribute view [%s] not found in box [%s]","messagePattern":"attribute view \\[(.+?)\\] not found in box \\[(.+?)\\]","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/template.go","lineNumber":576,"sourceCode":"\t\tif !entering || ast.NodeAttributeView != n.Type {\n\t\t\treturn ast.WalkContinue\n\t\t}\n\n\t\tmode, modeErr := templateAttributeViewMode(n)\n\t\tif nil != modeErr {\n\t\t\terr = modeErr\n\t\t\treturn ast.WalkStop\n\t\t}\n\t\tif TemplateDatabaseModeReference == mode {\n\t\t\tsource := referenceSources[n.AttributeViewID]\n\t\t\tif nil == source {\n\t\t\t\tsource, modeErr = av.ParseAttributeViewInBox(n.AttributeViewID, boxID)\n\t\t\t\tif nil != modeErr {\n\t\t\t\t\terr = fmt.Errorf(\"parse attribute view [%s] in box [%s] failed: %w\", n.AttributeViewID, boxID, modeErr)\n\t\t\t\t\treturn ast.WalkStop\n\t\t\t\t}\n\t\t\t\tif nil == source || source.ID != n.AttributeViewID {\n\t\t\t\t\terr = fmt.Errorf(\"attribute view [%s] not found in box [%s]\", n.AttributeViewID, boxID)\n\t\t\t\t\treturn ast.WalkStop\n\t\t\t\t}\n\t\t\t\treferenceSources[n.AttributeViewID] = source\n\t\t\t}\n\t\t\tselectedView, validateErr := validateTemplateAttributeViewNode(n, source)\n\t\t\tif nil != validateErr {\n\t\t\t\terr = validateErr\n\t\t\t\treturn ast.WalkStop\n\t\t\t}\n\t\t\tplans[n] = &templateAttributeViewPlan{\n\t\t\t\tmode: mode, source: source, target: source, selectedView: selectedView,\n\t\t\t}\n\t\t\treturn ast.WalkContinue\n\t\t}\n\n\t\tsource := copySources[n.AttributeViewID]\n\t\tif nil == source {\n\t\t\tsource, modeErr = av.ParseAttributeView(n.AttributeViewID)","sourceCodeStart":558,"sourceCodeEnd":594,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/model/template.go#L558-L594","documentation":"In reference mode the loaded attribute view must be non-nil and its ID must match the ID referenced by the template node. If ParseAttributeViewInBox returns nil or an attribute view with a different ID, the reference is treated as dangling and rendering stops with this error.","triggerScenarios":"Rendering a template whose database node points to an attribute view ID that does not resolve inside the given box — file absent, or file contents carry a different/legacy ID.","commonSituations":"Copying templates between notebooks/boxes where the referenced database only exists in the original box; renaming/migrating databases so stored IDs no longer match; ID typos in hand-written templates.","solutions":["Create the referenced database in the target box, or switch the template node's database mode from reference to copy","Correct the AttributeViewID in the template to match a database that actually exists in the box","If the ID mismatch is a migration artifact, re-save the attribute view so its stored ID equals its filename ID"],"exampleFix":"// before: reference to a database living in another box\nnode.AttributeViewID = \"20240101120000-fromotherbox\"\n// after: use copy mode so the database is duplicated into this box\nmode = TemplateDatabaseModeCopy","handlingStrategy":"validation","validationCode":"src, err := av.ParseAttributeViewInBox(avID, boxID)\nif err != nil || src == nil || src.ID != avID {\n    return fmt.Errorf(\"av %s not resolvable in box %s\", avID, boxID)\n}","typeGuard":"func avResolvable(src *av.AttributeView, wantID string) bool {\n    return src != nil && src.ID == wantID\n}","tryCatchPattern":"if err != nil {\n    // surface a user-facing message suggesting copy mode instead\n    return fmt.Errorf(\"database %s unavailable in this notebook: %w\", avID, err)\n}","preventionTips":["When sharing templates across notebooks, use copy mode, not reference mode","Verify AttributeViewID matches the target database's actual ID","Avoid hand-editing template database IDs"],"tags":["go","attribute-view","not-found","reference"],"backgroundTag":"entity-not-found","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"}