siyuan-note/siyuan · error

attribute view [ ] visible view [ ] not found

Error message

attribute view [%s] visible view [%s] not found

What it means

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.

Solutions

  1. Remove the stale ID from custom-visible-view-ids or replace it with an existing view ID
  2. Remove the whole custom-visible-view-ids attribute so no visibility filtering is applied
  3. Verify each comma-separated ID against the database's current views in the UI
  4. Regenerate the template from a workspace where the database and its views exist

Example fix

<!-- before -->
<div custom-visible-view-ids="20240101120000-gone,20240101120001-ok" ...></div>
<!-- after -->
<div custom-visible-view-ids="20240101120001-ok" ...></div>
Defensive patterns

Strategy: validation

Validate before calling

const av = await getAttrView(avID);
const ids = (attrs["custom-visible-view-ids"] || "").split(",").map(s => s.trim()).filter(Boolean);
const bad = ids.filter(id => !av.views.some(v => v.id === id));
if (bad.length) await setBlockAttrs(blockID, {"custom-visible-view-ids": ids.filter(id => !bad.includes(id)).join(",")});

Try / catch

try {
  await insertTemplate(path);
} catch (e) {
  if (String(e).includes("visible view [").includes("not found")) {
    await dropStaleVisibleViewIDs(blockID); // rewrite list, retry
  }
}

Prevention

When it happens

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

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

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@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/894de6cb723538a2. Report an issue: GitHub.

Appendix: source

Thrown at kernel/model/template.go:597

			return nil, fmt.Errorf("attribute view [%s] view [%s] not found", attrView.ID, viewID)
		}
	} else if selectedView, err = attrView.GetFirstView(); nil != err {
		return nil, fmt.Errorf("attribute view [%s] has no available view: %w", attrView.ID, err)
	}

	visibleViewIDs := strings.TrimSpace(node.IALAttr(av.NodeAttrVisibleViewIDs))
	if "" == visibleViewIDs {
		return
	}
	visibleViewCount := 0
	for _, visibleViewID := range strings.Split(visibleViewIDs, ",") {
		visibleViewID = strings.TrimSpace(visibleViewID)
		if "" == visibleViewID {
			continue
		}
		visibleViewCount++
		if nil == attrView.GetView(visibleViewID) {
			return nil, fmt.Errorf("attribute view [%s] visible view [%s] not found", attrView.ID, visibleViewID)
		}
	}
	if 1 > visibleViewCount {
		return nil, fmt.Errorf("attribute view [%s] has no available visible view", attrView.ID)
	}
	return
}

func resolveCopyTemplateAttributeView(node *ast.Node, attrView *av.AttributeView) *av.View {
	if viewID := strings.TrimSpace(node.IALAttr(av.NodeAttrView)); "" != viewID {
		if view := attrView.GetView(viewID); nil != view {
			return view
		}
	}
	view, _ := attrView.GetFirstView()
	return view
}

View on GitHub (pinned to 9f775e8a12)