{"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":671,"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)\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":653,"sourceCodeEnd":689,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/av/av.go#L653-L689","documentation":"Logged and returned by loadAttributeViewSearchInfoInBox when cache.SetAVSearchDataInBox returns false after successfully parsing the AV data — meaning the on-disk data version no longer matches the version captured at read time. The AV was concurrently modified/saved (bumping its version) between the read and the cache-write, so the parsed search info was discarded as stale. This is a warn-level race signal, not data corruption.","triggerScenarios":"Concurrent API calls: one thread loads search info (reads AV JSON at version N) while another thread saves the same AV (bumping version to N+1). When the loader tries to cache, the version check fails. Happens under rapid edits, sync, or background re-indexing touching the same AV.","commonSituations":"Two browser tabs editing the same database; a sync pull landing while the user is filtering; batch operations iterating AVs while one is being saved; full-text re-index racing an interactive edit.","solutions":["Retry the search-info read; the next attempt will pick up the new version and cache it.","Reduce concurrent writers on the same AV (serialize saves) if the warning is frequent.","Treat as benign in logs unless it persists for the same avID indefinitely, which would indicate a stuck version bump."],"exampleFix":"// before\ninfo, err := av.GetAttributeViewSearchInfoInBox(avID, boxID)\n\n// after: retry once on the stale-version race\ninfo, err := av.GetAttributeViewSearchInfoInBox(avID, boxID)\nif err != nil && strings.Contains(err.Error(), \"changed while loading\") {\n    info, err = av.GetAttributeViewSearchInfoInBox(avID, boxID)\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"info, err := av.GetAttributeViewSearchInfoInBox(avID, boxID)\nif err != nil && strings.Contains(err.Error(), \"changed while loading\") {\n    // AV was saved concurrently; one retry picks up the new version\n    info, err = av.GetAttributeViewSearchInfoInBox(avID, boxID)\n}","preventionTips":["Serialize concurrent saves to the same AV to minimize version races.","Treat the warning as benign in logs unless it persists for one avID indefinitely.","Avoid issuing reads and writes to the same AV from multiple tabs simultaneously."],"tags":["concurrency","cache","attribute-view","race","version"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}