siyuan-note/siyuan · error

attribute view [%s] not found in box [%s]

Error message

attribute view [%s] not found in box [%s]

What it means

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.

Source

Thrown at kernel/model/template.go:576

		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 8641553a1f)

Solutions

  1. Create the referenced database in the target box, or switch the template node's database mode from reference to copy
  2. Correct the AttributeViewID in the template to match a database that actually exists in the box
  3. If the ID mismatch is a migration artifact, re-save the attribute view so its stored ID equals its filename ID

Example fix

// before: reference to a database living in another box
node.AttributeViewID = "20240101120000-fromotherbox"
// after: use copy mode so the database is duplicated into this box
mode = TemplateDatabaseModeCopy
Defensive patterns

Strategy: validation

Validate before calling

src, err := av.ParseAttributeViewInBox(avID, boxID)
if err != nil || src == nil || src.ID != avID {
    return fmt.Errorf("av %s not resolvable in box %s", avID, boxID)
}

Type guard

func avResolvable(src *av.AttributeView, wantID string) bool {
    return src != nil && src.ID == wantID
}

Try / catch

if err != nil {
    // surface a user-facing message suggesting copy mode instead
    return fmt.Errorf("database %s unavailable in this notebook: %w", avID, err)
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

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


AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11). Data as JSON: /api/errors/8cf20e638ddd5a05. Report an issue: GitHub.