siyuan-note/siyuan · warning

attribute view [ ] changed while loading search info

Error message

attribute view [%s] changed while loading search info

What it means

When loading an attribute view's search info, the engine caches a versioned snapshot of the AV data. If between reads the underlying attribute view changed so the cached version no longer matches (SetAVSearchDataInBox fails), the loader gives up and returns this error rather than serving stale search data. It signals a transient consistency conflict, not corruption.

Solutions

  1. Retry the search/query after a short delay — the conflict is usually transient
  2. Pause concurrent writes/sync to the attribute view while querying, or query a quiescent moment
  3. Ensure the AV's .av JSON is not being modified by external tools during access
  4. If it recurs persistently, check for sync loops or duplicate AV IDs across notebooks

Example fix

// before
av, err := av.SearchAttributeView(avID)
// after
var av *av.AttributeView
for i := 0; i < 3; i++ {
  if av, err = avLib.SearchAttributeView(avID); err == nil || !strings.Contains(err.Error(), "changed while loading") {
    break
  }
  time.Sleep(200 * time.Millisecond)
}
Defensive patterns

Strategy: retry

Try / catch

var av *av.AttributeView
var err error
for i := 0; i < 3; i++ {
  av, err = avlib.LoadSearchInfo(avID)
  if err == nil || !strings.Contains(err.Error(), "changed while loading search info") {
    break
  }
  time.Sleep(300 * time.Millisecond)
}

Prevention

When it happens

Trigger: Concurrent edits to the attribute view (cell updates, view changes) while a search/query loads its data; rapid successive queries where the AV is re-indexed between them; sync applying remote AV changes mid-query.

Common situations: Background indexing or sync running while the user types in a database search; automated scripts querying an AV that a plugin is actively modifying; large AVs whose load window overlaps an edit.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/92ffbd2083cb5861. Report an issue: GitHub.

Appendix: source

Thrown at kernel/av/av.go:682

			if avBoxID != "" {
				if data, err = decryptAVDataLocked(avBoxID, avID, data); err != nil {
					logging.LogErrorf("decrypt attribute view [%s] failed: %s", avJSONPath, err)
					return
				}
			} else if util.IsCiphertext(data) {
				return nil, nil
			}
		}

		if ret, err = parseAttributeViewSearchInfo(data); err != nil {
			logging.LogErrorf("unmarshal attribute view search info [%s] failed: %s", avID, err)
			return nil, err
		}
		if cache.SetAVSearchDataInBox(avID, avBoxID, dataVersion, ret) {
			return ret, nil
		}
	}
	err = fmt.Errorf("attribute view [%s] changed while loading search info", avID)
	logging.LogWarnf("%s", err)
	return nil, err
}

func GetAttributeViewContent(avID string) (content string) {
	if "" == avID {
		return
	}

	attrView, err := parseAttributeView(avID, false)
	if err != nil {
		logging.LogErrorf("parse attribute view [%s] failed: %s", avID, err)
		return
	}
	if nil == attrView {
		return
	}
	return getAttributeViewContent0(attrView)

View on GitHub (pinned to 9f775e8a12)