{"record":{"id":"3bcbc756ef44b9df","repo":"siyuan-note/siyuan","slug":"errrichtextspecmismatch","errorCode":"ErrRichTextSpecMismatch","errorMessage":"attribute view rich text requires storage spec 9","messagePattern":"attribute view rich text requires storage spec 9","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/av/av.go","lineNumber":1392,"sourceCode":"\t}\n\treturn\n}\n\nfunc GetAttributeViewI18n(key string) string {\n\treturn util.AttrViewLangs[util.Lang][key].(string)\n}\n\nvar (\n\tErrAttributeViewNotFound  = errors.New(\"attribute view not found\")\n\tErrInvalidAttributeViewID = errors.New(\"invalid attribute view id\")\n\tErrInvalidBoxID           = errors.New(\"invalid box id\")\n\tErrViewNotFound           = errors.New(\"view not found\")\n\tErrKeyNotFound            = errors.New(\"key not found\")\n\tErrItemNotFound           = errors.New(\"item not found\")\n\tErrWrongLayoutType        = errors.New(\"wrong layout type\")\n\tErrInvalidColumnAlign     = errors.New(\"invalid column align\")\n\tErrSpecTooNew             = errors.New(\"attribute view spec is too new\")\n\tErrRichTextSpecMismatch   = errors.New(\"attribute view rich text requires storage spec 9\")\n\tErrFilterTooDeep          = errors.New(\"filter nesting depth exceeds the maximum allowed\")\n)\n\nconst (\n\tNodeAttrNameAvs        = \"custom-avs\"                  // 用于标记块所属的属性视图，逗号分隔 av id\n\tNodeAttrView           = \"custom-sy-av-view\"           // 用于标记块所属的属性视图视图 view id Database block support specified view https://github.com/siyuan-note/siyuan/issues/10443\n\tNodeAttrVisibleViewIDs = \"custom-sy-av-visible-views\"  // 用于标记数据库块显示的视图 ID，逗号分隔\n\tNodeAttrContextFilter  = \"custom-sy-av-context-filter\" // 用于保存数据库块独有的上下文筛选配置\n\tNodeAttrViewStaticText = \"custom-sy-av-s-text\"         // 用于标记块所属的属性视图静态文本 Database-bound block primary key supports setting static anchor text https://github.com/siyuan-note/siyuan/issues/10049\n\n\tNodeAttrViewNames = \"av-names\" // 用于临时标记块所属的属性视图名称，空格分隔\n)\n","sourceCodeStart":1374,"sourceCodeEnd":1405,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/av/av.go#L1374-L1405","documentation":"ErrRichTextSpecMismatch is raised by CheckSpec when an attribute view contains rich-text values (ValueTextRichFormatKramdown) but its storage Spec is below the required RichTextSpec (9). Rich text requires the newer storage layout, so older-spec files with rich values are rejected instead of silently degraded.","triggerScenarios":"Loading/validating an attribute view where Spec < RichTextSpec and HasRichText() is true — e.g. hand-edited or partially migrated JSON where values were upgraded but the spec field wasn't; TestUpgradeSpec9OnlyForRichText exercises the mismatch branch.","commonSituations":"A custom migration script bumped value formats but forgot to set spec to 9; merging attribute views from different versions; downgrade followed by edits reintroducing rich values into an old-spec file.","solutions":["Upgrade the attribute view's Spec to 9 (RichTextSpec) when it contains rich-text values","Run the official spec-upgrade path rather than editing values manually","Validate with CheckSpec after any migration; revert the value formats if spec must stay < 9"],"exampleFix":"// before\nav := &AttributeView{Spec: 8, ...} // values rich\n// after\nif av.Spec < RichTextSpec && av.HasRichText() {\n    av.Spec = RichTextSpec // upgrade storage spec\n}\nif err := CheckSpec(av); err != nil { return err }","handlingStrategy":"validation","validationCode":"if av.Spec < av.RichTextSpec && av.HasRichText() {\n    return errors.New(\"upgrade spec to 9 or strip rich-text values\")\n}","typeGuard":null,"tryCatchPattern":"if err := CheckSpec(av); err != nil {\n    if errors.Is(err, av.ErrRichTextSpecMismatch) {\n        av.Spec = av.RichTextSpec // run official upgrade path\n    }\n}","preventionTips":["Always run the official spec upgrade when migrating values","Never hand-edit .av JSON spec fields partially","Re-validate with CheckSpec after any migration or merge"],"tags":["attribute-view","spec","rich-text"],"backgroundTag":"schema-validation-failed","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"}