siyuan-note/siyuan · error
bind attribute view item
Error message
bind attribute view item [%s] failed: %w
What it means
After a document is created for a detached item, CreateAttributeViewItemDocs builds the bound value via newBoundAttributeViewItemValue. Any error from that step is wrapped as "bind attribute view item [%s] failed: %w" and, because docs were already created, the returned newItemCreationError also carries cleanup results (created docs are removed). It means the item row could not be converted into a block-bound value for the newly created document.
Solutions
- Read the wrapped %w cause: it is almost always "clone attribute view item failed"; fix the underlying malformed value (recreate the row) and retry
- Check the appended cleanup error to see whether leftover created documents need manual deletion in the doc tree
- Retry the batch after sync settles, excluding the item that failed
Defensive patterns
Strategy: try-catch
Type guard
func bindable(v *av.Value) bool { return v != nil && v.Clone() != nil && v.Clone().Block != nil } Try / catch
res, err := model.CreateAttributeViewItemDocs(avID, blockID, mode, itemIDs)
if err != nil {
var ce error
if errors.As(err, &ce) { /* inspect wrapped clone error and cleanup error */ }
} Prevention
- Avoid concurrent edits/sync while batch-converting items to documents
- Check the cleanup error portion for leftover documents
- Recreate rows whose values fail to clone
When it happens
Trigger: CreateAttributeViewItemDocs on an item whose cloned value loses its Block field during Clone (newBoundAttributeViewItemValue returns "clone attribute view item failed"), which is then wrapped with the item ID by this error.
Common situations: Same malformed/corrupt .av row data as the clone failure; race where the row is edited between reading and binding; batch conversion interrupted by sync rewriting the attribute view mid-run.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- clone attribute view item failed
- clone attribute view item
- invalid create attribute view item documents save mode
- new attribute view item document in an encrypted notebook…
- new item template field
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/90cdcd68dcca9671.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/attribute_view_new_item.go:283
cleanupCreatedDocs := func() error {
var cleanupErr error
for i := len(items) - 1; 0 <= i; i-- {
if "" != items[i].docID {
cleanupErr = errors.Join(cleanupErr, removeCreatedNewItemDoc(items[i].docID))
}
}
return cleanupErr
}
for _, item := range items {
item.docID, item.tree, err = createAttributeViewItemDocument(item.preview, itemTemplate)
if nil != err {
return nil, newItemCreationError(err, cleanupCreatedDocs())
}
icon, _ := getNodeAvBlockText(item.tree.Root, "")
item.bound, err = newBoundAttributeViewItemValue(item.original, item.docID, icon)
if nil != err {
return nil, newItemCreationError(fmt.Errorf("bind attribute view item [%s] failed: %w", item.itemID, err), cleanupCreatedDocs())
}
ret.ItemIDs = append(ret.ItemIDs, item.itemID)
ret.BlockIDs = append(ret.BlockIDs, item.docID)
}
var doOperations, undoOperations []*Operation
for _, item := range items {
doOperations = append(doOperations,
&Operation{Action: "restoreCreatedDoc", ID: item.docID, Tree: item.tree},
&Operation{
Action: "replaceAttrViewBlock", AvID: avID, BlockID: blockID, PreviousID: item.itemID, NextID: item.docID,
IsDetached: false,
},
&Operation{
Action: "updateAttrViewCell", ID: item.bound.ID, AvID: avID, KeyID: item.bound.KeyID,
RowID: item.itemID, Data: item.bound,
},
)View on GitHub (pinned to 9f775e8a12)