{"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":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/av/value.go","lineNumber":561,"sourceCode":"}\n\n// IsRich 返回文本值是否包含富文本源。\nfunc (value *ValueText) IsRich() bool {\n\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\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":543,"sourceCodeEnd":579,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/av/value.go#L543-L579","documentation":"parseValueTextRich in kernel/av/value.go parses an attribute-view rich-text payload only if its Spec integer equals the compile-time ValueTextRichSpec constant the kernel supports. A payload written by a different (older or newer) spec version is rejected with this error rather than parsed speculatively, protecting the sanitizer and renderer from unknown markup semantics.","triggerScenarios":"Calling ParseValueTextRich, NormalizeValueTextRich, or normalizeValueTextRichTreeSource with a ValueTextRich whose Spec field differs from ValueTextRichSpec — typically data persisted by another SiYuan version or hand-crafted rich-text values with a guessed spec number.","commonSituations":"Downgrading SiYuan after a rich-text spec bump; copying database content between workspaces of different versions; tests or plugins constructing ValueTextRich literals with a hardcoded wrong Spec.","solutions":["Upgrade (or reinstall) the SiYuan kernel so ValueTextRichSpec matches the data's spec","Set rich.Spec = av.ValueTextRichSpec when constructing the payload programmatically","Re-save the cell in the UI so the kernel rewrites the rich text with the current spec","Restore the affected data from a backup made under the matching version"],"exampleFix":"// before\nrich := &av.ValueTextRich{Spec: 1, Format: av.ValueTextRichFormatKramdown, Content: \"**hi\"}\n// after\nrich := &av.ValueTextRich{Spec: av.ValueTextRichSpec, Format: av.ValueTextRichFormatKramdown, Content: \"**hi\"}","handlingStrategy":"type-guard","validationCode":"if rich.Spec != av.ValueTextRichSpec { return fmt.Errorf(\"spec %d != %d\", rich.Spec, av.ValueTextRichSpec) }","typeGuard":"func isCurrentSpec(r *av.ValueTextRich) bool { return r != nil && r.Spec == av.ValueTextRichSpec }","tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"unsupported attribute view rich text spec\") {\n    // data from another version: route through re-save/upgrade path\n}","preventionTips":["Always use the av.ValueTextRichSpec constant, never a literal","Don't copy database JSON between workspaces running different SiYuan versions","Avoid downgrading a workspace after a spec bump"],"tags":["attribute-view","rich-text","spec-version","compatibility"],"backgroundTag":"incompatible-source-type","analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}