siyuan-note/siyuan · error
attribute view [ ] not found in box [ ]
Error message
attribute view [%s] not found in box [%s]
What it means
When rendering a template that contains a database (attribute view) block in reference mode, the kernel tries to load the referenced attribute view from the notebook (box) derived from the template source tree. If ParseAttributeViewInBox returns nothing or an attribute view whose ID does not match the node's AttributeViewID, the walk stops with this error. It guards against stale or dangling database references inside templates.
Solutions
- Verify the attribute view ID in the template block's custom attribute (custom-av) exists in the template's notebook (storage/av/ under the box).
- Remove or fix the stale database block in the template, or recreate the referenced database and update the ID.
- If the reference is intended cross-notebook, move the template into the box that actually contains the attribute view.
Example fix
// before (template block IAL)
{: custom-av id="20240101120000-abcdefg"}
// after: point at an existing av in this box, or switch the block to copy mode
{: custom-av id="20240501100000-xyz1234" type="NodeAttributeView"} Defensive patterns
Strategy: validation
Validate before calling
// Go caller: check the av exists in the box before rendering
if _, err := os.Stat(filepath.Join(workspace, "data", boxID, ".siyuan", "storage", "av", avID+".json")); err != nil {
return fmt.Errorf("attribute view %s missing in box %s", avID, boxID)
} Try / catch
if err != nil {
if strings.Contains(err.Error(), "not found in box") {
// recreate or remove the stale database block
return recoverStaleAvReference(avID, boxID)
}
return err
} Prevention
- Keep templates in the same notebook as the databases they reference
- When sharing templates, export referenced databases together
- Periodically audit custom-av IDs in templates against existing .av files
When it happens
Trigger: Rendering a template (RenderTemplateWithMode / PreviewTemplateSource) whose tree contains an ast.NodeAttributeView with a 'custom-av' style reference mode whose AttributeViewID does not exist under the template's box, e.g. the .av file was deleted, the ID was copy-pasted from another notebook, or the box ID is wrong.
Common situations: A template was shared/exported between notebooks without the referenced database; a user deleted the database but kept the template block; the database ID in the template was hand-edited; sync conflicts left the block pointing at a removed attribute view file.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- attribute view [ ] template plan not found
- attribute view [ ] view [ ] not found
- attribute view [ ] visible view [ ] not found
- child template definition
- database blocks are not supported by createDocTree templates
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/8cf20e638ddd5a05.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/template.go:660
if !entering || ast.NodeAttributeView != n.Type {
return ast.WalkContinue
}
mode, modeErr := templateAttributeViewMode(n)
if nil != modeErr {
err = modeErr
return ast.WalkStop
}
if TemplateDatabaseModeReference == mode {
source := referenceSources[n.AttributeViewID]
if nil == source {
source, modeErr = av.ParseAttributeViewInBox(n.AttributeViewID, boxID)
if nil != modeErr {
err = fmt.Errorf("parse attribute view [%s] in box [%s] failed: %w", n.AttributeViewID, boxID, modeErr)
return ast.WalkStop
}
if nil == source || source.ID != n.AttributeViewID {
err = fmt.Errorf("attribute view [%s] not found in box [%s]", n.AttributeViewID, boxID)
return ast.WalkStop
}
referenceSources[n.AttributeViewID] = source
}
selectedView, validateErr := validateTemplateAttributeViewNode(n, source)
if nil != validateErr {
err = validateErr
return ast.WalkStop
}
plans[n] = &templateAttributeViewPlan{
mode: mode, source: source, target: source, selectedView: selectedView,
}
return ast.WalkContinue
}
source := copySources[n.AttributeViewID]
if nil == source {
source, modeErr = av.ParseAttributeView(n.AttributeViewID)View on GitHub (pinned to 9f775e8a12)