siyuan-note/siyuan · error

attribute view [ ] is not bound

Error message

attribute view [%s] is not bound

What it means

When reordering bound attribute views (e.g. detaching or moving a view within a block's bound-views list), the kernel searches the current binding list for the given avID. If the attribute view is not actually bound to that block, it cannot be unbound/reordered and this error is returned.

Solutions

  1. Re-fetch the block's bound attribute views and confirm the avID is in the list before unbinding/moving
  2. Use the correct avID for the target block
  3. Make the unbind operation idempotent: skip the call when the view is already absent
  4. Refresh UI state after any unbind so stale IDs are not reused

Example fix

// before
await fetchPost("/api/av/removeAttributeView", {avID: staleAvID, blockID})
// after
const bound = await getBoundAvIDs(blockID);
if (bound.includes(avID)) await fetchPost("/api/av/removeAttributeView", {avID, blockID});
Defensive patterns

Strategy: validation

Validate before calling

const bound = await getBoundAvIDs(blockID);
if (!bound.includes(avID)) throw new Error(`attribute view ${avID} is not bound to ${blockID}`);

Try / catch

try { await unbindAttributeView({avID, blockID}); } catch (e) { if (String(e).includes("is not bound")) { /* treat as already unbound; refresh state */ } else { throw e; } }

Prevention

When it happens

Trigger: Calling the unbind/move attribute view API with operation.AvID that is not present in the block's bound attribute view ID list; operating on a stale avID after the view was already unbound or the block deleted.

Common situations: Plugin holding an outdated list of bound views; double-invocation of an unbind action; copying an avID from a different block; view deleted in another client between fetch and call.

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/7cf78ebcaaa6507e. Report an issue: GitHub.

Appendix: source

Thrown at kernel/model/attribute_view.go:8597

	}
	return
}

func sortAttrViewBindingIDs(avIDs []string, avID, previousAvID string) (ret []string, err error) {
	ret = append([]string(nil), avIDs...)
	if avID == previousAvID {
		return
	}

	index := -1
	for i, id := range ret {
		if id == avID {
			index = i
			break
		}
	}
	if 0 > index {
		return nil, fmt.Errorf("attribute view [%s] is not bound", avID)
	}

	ret = append(ret[:index], ret[index+1:]...)
	previousIndex := -1
	if "" != previousAvID {
		for i, id := range ret {
			if id == previousAvID {
				previousIndex = i
				break
			}
		}
		if 0 > previousIndex {
			return nil, fmt.Errorf("previous attribute view [%s] is not bound", previousAvID)
		}
	}

	ret = util.InsertElem(ret, previousIndex+1, avID)
	return

View on GitHub (pinned to 9f775e8a12)