siyuan-note/siyuan · error

previous attribute view

Error message

previous attribute view [%s] is not bound

What it means

When inserting/moving an attribute view to a position after a 'previous' view, the kernel verifies that previousAvID is itself bound to the block. If the previous view ID is not found in the binding list, the insertion point is invalid and this error is returned.

Solutions

  1. Verify previousAvID exists in the block's current bound-views list before inserting
  2. Omit previousAvID (or use the appropriate append mode) when inserting at the end
  3. Re-fetch the binding list after any unbind/delete to refresh drop targets
  4. Fix the drop-target computation so it only offers currently bound views

Example fix

// before
await fetchPost("/api/av/bindAttributeView", {avID, blockID, previousAvID: stalePrevID})
// after
const bound = await getBoundAvIDs(blockID);
const previousAvID = bound.includes(stalePrevID) ? stalePrevID : ""; // or pick a valid one
await fetchPost("/api/av/bindAttributeView", {avID, blockID, previousAvID})
Defensive patterns

Strategy: validation

Validate before calling

const bound = await getBoundAvIDs(blockID);
if (previousAvID && !bound.includes(previousAvID)) throw new Error(`previous view ${previousAvID} is not bound`);

Try / catch

try { await bindAttributeView({avID, blockID, previousAvID}); } catch (e) { if (String(e).includes("previous attribute view")) { retryWithoutPrevious(); } else { throw e; } }

Prevention

When it happens

Trigger: Calling the bind/insert attribute view API with operation.PreviousAvID referencing a view that is not bound to the block (wrong ID, already unbound, or belongs to another block).

Common situations: Plugin computing insertion position from a cached list; passing empty-vs-wrong previousAvID handling mixed up; UI drag-and-drop sending a stale drop-target ID.

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

Appendix: source

Thrown at kernel/model/attribute_view.go:8610

			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
}

func bindBlockAv(tx *Transaction, avID, blockID string) {
	node, tree, err := getNodeByBlockID(tx, blockID)
	if err != nil {
		return
	}

	bindBlockAv0(tx, avID, node, tree)
	return
}

func bindBlockAv0(tx *Transaction, avID string, node *ast.Node, tree *parse.Tree) {

View on GitHub (pinned to 9f775e8a12)