siyuan-note/siyuan · error
attribute view [ ] has no available visible view
Error message
attribute view [%s] has no available visible view
What it means
After iterating the node's `custom-visible-view-ids` list, validateTemplateAttributeViewNode requires at least one non-empty, resolvable visible view. If the attribute is present but contains only blanks (e.g. empty strings after trimming between commas), zero visibleViewCount triggers this error. It prevents rendering a database block with no selectable visible view.
Solutions
- Remove the custom-visible-view-ids attribute entirely when all views should be available
- Populate it with at least one existing view ID
- Fix tooling that writes empty visible-view lists into template IAL
Example fix
<!-- before --> <div custom-visible-view-ids=", ," ...></div> <!-- after --> <div ...></div>
Defensive patterns
Strategy: validation
Validate before calling
const v = attrs["custom-visible-view-ids"];
if (v !== undefined && !String(v).split(",").some(s => s.trim())) {
await setBlockAttrs(blockID, {"custom-visible-view-ids": ""}); // or remove key
} Try / catch
try {
await insertTemplate(path);
} catch (e) {
if (String(e).includes("has no available visible view")) {
await removeAttrAndRetry(blockID, "custom-visible-view-ids");
}
} Prevention
- Remove the attribute key instead of blanking its value when clearing a list
- Sanitize IAL writes from scripts so empty lists become absent attributes
- Audit generated templates for empty comma-only attribute values
When it happens
Trigger: A template attribute-view node has `custom-visible-view-ids` set but its comma-split entries are all empty (attribute like `",,"` or whitespace-only), so the loop counts zero valid IDs. Raised during template render.
Common situations: Clearing the attribute's value without removing the key, programmatic IAL edits that leave the attribute blank, or templates generated by tooling that writes empty lists.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- attribute view [ ] has no available view
- attribute view [ ] not found in box [ ]
- attribute view [ ] template plan not found
- attribute view [ ] view [ ] not found
- attribute view [ ] visible view [ ] not found
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/7c2577ea70fd8e26.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/template.go:601
}
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
}
func copyTemplateAttributeView(source *av.AttributeView) (ret *templateAttributeViewCopy, err error) {
target := source.Clone()
if nil == target {
return nil, fmt.Errorf("clone attribute view [%s] failed", source.ID)View on GitHub (pinned to 9f775e8a12)