{"record":{"id":"14cbb4b62489d92c","repo":"siyuan-note/siyuan","slug":"unsupported-attribute-view-rich-text-spec-d","errorCode":null,"errorMessage":"unsupported attribute view rich text spec [%d]","messagePattern":"unsupported attribute view rich text spec \\[(.+?)\\]","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/av/value.go","lineNumber":565,"sourceCode":"\treturn nil != value && nil != value.Rich\n}\n\n// ParseValueTextRich 校验并解析文本字段的富文本源。\nfunc ParseValueTextRich(rich *ValueTextRich) (tree *parse.Tree, err error) {\n\t_, tree, err = parseValueTextRich(rich)\n\treturn\n}\n\nfunc parseValueTextRich(rich *ValueTextRich) (blockDOM string, tree *parse.Tree, err error) {\n\treturn parseValueTextRichWithImages(rich, false)\n}\n\nfunc parseValueTextRichWithImages(rich *ValueTextRich, images bool) (blockDOM string, tree *parse.Tree, err error) {\n\tif nil == rich {\n\t\treturn\n\t}\n\tif ValueTextRichSpec != rich.Spec {\n\t\terr = fmt.Errorf(\"unsupported attribute view rich text spec [%d]\", rich.Spec)\n\t\treturn\n\t}\n\tif ValueTextRichFormatKramdown != rich.Format {\n\t\terr = fmt.Errorf(\"unsupported attribute view rich text format [%s]\", rich.Format)\n\t\treturn\n\t}\n\n\tluteEngine := newValueTextRichLute()\n\tcontent, protectedStyleEntities, protectErr := protectValueTextRichKramdownStyleEntities(rich.Content)\n\tif nil != protectErr {\n\t\terr = protectErr\n\t\treturn\n\t}\n\tblockDOM, tree = luteEngine.Md2BlockDOMTree(content, true)\n\tif nil == tree || nil == tree.Root {\n\t\terr = fmt.Errorf(\"parse attribute view rich text failed\")\n\t\treturn\n\t}","sourceCodeStart":547,"sourceCodeEnd":583,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/av/value.go#L547-L583","documentation":"This error means the Spec field of a ValueTextRich (attribute view rich text payload) does not match the currently supported spec constant ValueTextRichSpec. The kernel rejects rich text data written by an unknown/other spec version so that content from a different format generation is never misinterpreted. It is a forward/backward compatibility guard at the parser entry point used by table cell and text value parsing.","triggerScenarios":"Calling ParseTableCellRich, ParseValueTextRich, or any path reaching parseValueTextRichWithImages with a *ValueTextRich whose Spec field is not the current ValueTextRichSpec constant (e.g. Spec: 2 when the kernel expects 1, or Spec left as zero value 0 when unmarshalling partial JSON).","commonSituations":"Restoring/copying .sy or DB data written by a newer (or older) SiYuan version; hand-crafting API payloads and omitting the spec field; plugin code constructing ValueTextRich manually; corrupted attribute-view records.","solutions":["Set the Spec field to the current ValueTextRichSpec constant exported from kernel/av/value.go instead of hard-coding a number","Unmarshal the JSON with the real ValueTextRich struct so Spec is populated correctly, rather than building it by hand","If the data came from another SiYuan version, upgrade/downgrade to a version whose ValueTextRichSpec matches, and let migration run before reading the attribute view","If zero, check whether the value object was constructed but never populated; initialize Rich from a parsed source instead"],"exampleFix":"// before\nrich := &av.ValueTextRich{Format: av.ValueTextRichFormatKramdown, Content: content}\n// after\nrich := &av.ValueTextRich{Spec: av.ValueTextRichSpec, Format: av.ValueTextRichFormatKramdown, Content: content}","handlingStrategy":"validation","validationCode":"if rich.Spec != av.ValueTextRichSpec { return fmt.Errorf(\"spec %d unsupported; expected %d\", rich.Spec, av.ValueTextRichSpec) }","typeGuard":null,"tryCatchPattern":"tree, err := av.ParseValueTextRich(rich); if err != nil && strings.Contains(err.Error(), \"unsupported attribute view rich text spec\") { /* reserialize via editor or remap spec */ }","preventionTips":["Always initialize ValueTextRich via its exported constants, never raw integers","When copying rich text records between stores, copy the whole struct, not selected fields","Round-trip test payloads through marshal/unmarshal of the real struct before sending to the kernel","Track SiYuan version upgrades for spec constant changes"],"tags":["attribute-view","compatibility","versioning","rich-text"],"backgroundTag":"unsupported-enum-value","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"}