{"record":{"id":"92ffbd2083cb5861","repo":"siyuan-note/siyuan","slug":"attribute-view-s-changed-while-loading-search-i","errorCode":null,"errorMessage":"attribute view [%s] changed while loading search info","messagePattern":"attribute view \\[(.+?)\\] changed while loading search info","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"kernel/av/av.go","lineNumber":682,"sourceCode":"\t\t\tif avBoxID != \"\" {\n\t\t\t\tif data, err = decryptAVDataLocked(avBoxID, avID, data); err != nil {\n\t\t\t\t\tlogging.LogErrorf(\"decrypt attribute view [%s] failed: %s\", avJSONPath, err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t} else if util.IsCiphertext(data) {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\n\t\tif ret, err = parseAttributeViewSearchInfo(data); err != nil {\n\t\t\tlogging.LogErrorf(\"unmarshal attribute view search info [%s] failed: %s\", avID, err)\n\t\t\treturn nil, err\n\t\t}\n\t\tif cache.SetAVSearchDataInBox(avID, avBoxID, dataVersion, ret) {\n\t\t\treturn ret, nil\n\t\t}\n\t}\n\terr = fmt.Errorf(\"attribute view [%s] changed while loading search info\", avID)\n\tlogging.LogWarnf(\"%s\", err)\n\treturn nil, err\n}\n\nfunc GetAttributeViewContent(avID string) (content string) {\n\tif \"\" == avID {\n\t\treturn\n\t}\n\n\tattrView, err := parseAttributeView(avID, false)\n\tif err != nil {\n\t\tlogging.LogErrorf(\"parse attribute view [%s] failed: %s\", avID, err)\n\t\treturn\n\t}\n\tif nil == attrView {\n\t\treturn\n\t}\n\treturn getAttributeViewContent0(attrView)","sourceCodeStart":664,"sourceCodeEnd":700,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/av/av.go#L664-L700","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Retry the search/query after a short delay — the conflict is usually transient","Pause concurrent writes/sync to the attribute view while querying, or query a quiescent moment","Ensure the AV's .av JSON is not being modified by external tools during access","If it recurs persistently, check for sync loops or duplicate AV IDs across notebooks"],"exampleFix":"// before\nav, err := av.SearchAttributeView(avID)\n// after\nvar av *av.AttributeView\nfor i := 0; i < 3; i++ {\n  if av, err = avLib.SearchAttributeView(avID); err == nil || !strings.Contains(err.Error(), \"changed while loading\") {\n    break\n  }\n  time.Sleep(200 * time.Millisecond)\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"var av *av.AttributeView\nvar err error\nfor i := 0; i < 3; i++ {\n  av, err = avlib.LoadSearchInfo(avID)\n  if err == nil || !strings.Contains(err.Error(), \"changed while loading search info\") {\n    break\n  }\n  time.Sleep(300 * time.Millisecond)\n}","preventionTips":["Avoid mutating the attribute view while issuing search queries against it","Retry transiently — the conflict resolves once concurrent edits/indexing settle","Watch for persistent occurrences, which may indicate sync loops or duplicate AV files"],"tags":["concurrency","race","attribute-view","retry"],"backgroundTag":"invalid-state-transition","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}