{"record":{"id":"d1d2bab4eb6a46f2","repo":"siyuan-note/siyuan","slug":"attribute-view-history-context-is-ambiguous-s","errorCode":null,"errorMessage":"attribute view history context is ambiguous [%s]","messagePattern":"attribute view history context is ambiguous \\[(.+?)\\]","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/attribute_view_render.go","lineNumber":1258,"sourceCode":"\t\tif gulu.File.IsExist(filepath.Join(historyDir, \"storage\", \"av\", avID+\".json\")) {\n\t\t\tboxIDs = append(boxIDs, \"\")\n\t\t}\n\t\tentries, _ := os.ReadDir(historyDir)\n\t\tfor _, entry := range entries {\n\t\t\tif !entry.IsDir() || !ast.IsNodeIDPattern(entry.Name()) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcandidate := filepath.Join(historyDir, entry.Name(), \"storage\", \"av\", avID+\".json\")\n\t\t\tif gulu.File.IsExist(candidate) {\n\t\t\t\tboxIDs = append(boxIDs, entry.Name())\n\t\t\t}\n\t\t}\n\t}\n\tif len(boxIDs) == 0 {\n\t\treturn \"\", av.ErrAttributeViewNotFound\n\t}\n\tif len(boxIDs) != 1 {\n\t\treturn \"\", fmt.Errorf(\"attribute view history context is ambiguous [%s]\", avID)\n\t}\n\tif IsEncryptedBox(boxIDs[0]) {\n\t\treturn boxIDs[0], nil\n\t}\n\treturn \"\", nil\n}\n\nfunc loadHistoryWorkspacePalette(historyDir string) (\n\tret []*av.AttributeViewCustomColor, order []string, found bool,\n) {\n\tpath := filepath.Join(historyDir, \"storage\", \"inline-styles.json\")\n\tif !gulu.File.IsExist(path) {\n\t\treturn nil, nil, false\n\t}\n\tdata, err := os.ReadFile(path)\n\tif nil != err {\n\t\tlogging.LogWarnf(\"read historical inline styles failed: %s\", err)\n\t\treturn nil, nil, false","sourceCodeStart":1240,"sourceCodeEnd":1276,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/attribute_view_render.go#L1240-L1276","documentation":"ResolveHistoryAttributeViewBoxID globs the history directory for entries matching the timestamp prefix and collects the notebook (box) IDs that contain the attribute view. Uniqueness is required: if the avID is found under more than one box in the same history window, the context is ambiguous and this error is returned.","triggerScenarios":"The same attribute view ID appears under multiple notebooks within history snapshots at the given created timestamp — typically after documents were copied/moved between notebooks and both histories captured it.","commonSituations":"Copying a document with a database between notebooks then browsing history; sync conflicts duplicating av files across boxes; restored backups retaining duplicates.","solutions":["Identify which history entry/box is the intended one and remove or ignore the duplicate","Deduplicate the attribute view file across notebooks in the history window","Supply explicit notebook context upstream so resolution does not have to guess"],"exampleFix":"// before\nboxID, err := model.ResolveHistoryAttributeViewBoxID(avID, created) // ambiguous\n// after\n// narrow the history window or deduplicate boxes first\nboxID, err := model.ResolveHistoryAttributeViewBoxID(avID, createdAtExactSnapshot)","handlingStrategy":"try-catch","validationCode":"boxIDs := collectHistoryBoxIDs(avID, createdPrefix)\nif len(boxIDs) > 1 { return ErrAmbiguous }","typeGuard":null,"tryCatchPattern":"boxID, err := model.ResolveHistoryAttributeViewBoxID(avID, created)\nif err != nil && strings.Contains(err.Error(), \"history context is ambiguous\") {\n    return letUserSelectSourceNotebook(avID)\n}","preventionTips":["Deduplicate av files across notebooks before creating history snapshots","Resolve sync conflicts so the same avID does not live in multiple boxes","Narrow history queries to a specific snapshot when duplicates are known"],"tags":["history","ambiguity","repo"],"backgroundTag":"unexpected-response-shape","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"}