siyuan-note/siyuan · error
ErrRichTextSpecMismatch
ErrRichTextSpecMismatch
Error message
attribute view rich text requires storage spec 9
What it means
ErrRichTextSpecMismatch means an attribute view contains rich-text (kramdown) cell values but its storage Spec is below RichTextSpec (9), so the storage format cannot represent rich text. CheckSpec rejects the view to prevent silently degrading rich-text content to plain text.
Source
Thrown at kernel/av/av.go:1348
}
return
}
func GetAttributeViewI18n(key string) string {
return util.AttrViewLangs[util.Lang][key].(string)
}
var (
ErrAttributeViewNotFound = errors.New("attribute view not found")
ErrInvalidAttributeViewID = errors.New("invalid attribute view id")
ErrInvalidBoxID = errors.New("invalid box id")
ErrViewNotFound = errors.New("view not found")
ErrKeyNotFound = errors.New("key not found")
ErrItemNotFound = errors.New("item not found")
ErrWrongLayoutType = errors.New("wrong layout type")
ErrInvalidColumnAlign = errors.New("invalid column align")
ErrSpecTooNew = errors.New("attribute view spec is too new")
ErrRichTextSpecMismatch = errors.New("attribute view rich text requires storage spec 9")
ErrFilterTooDeep = errors.New("filter nesting depth exceeds the maximum allowed")
)
const (
NodeAttrNameAvs = "custom-avs" // 用于标记块所属的属性视图,逗号分隔 av id
NodeAttrView = "custom-sy-av-view" // 用于标记块所属的属性视图视图 view id Database block support specified view https://github.com/siyuan-note/siyuan/issues/10443
NodeAttrVisibleViewIDs = "custom-sy-av-visible-views" // 用于标记数据库块显示的视图 ID,逗号分隔
NodeAttrContextFilter = "custom-sy-av-context-filter" // 用于保存数据库块独有的上下文筛选配置
NodeAttrViewStaticText = "custom-sy-av-s-text" // 用于标记块所属的属性视图静态文本 Database-bound block primary key supports setting static anchor text https://github.com/siyuan-note/siyuan/issues/10049
NodeAttrViewNames = "av-names" // 用于临时标记块所属的属性视图名称,空格分隔
)
View on GitHub (pinned to 8641553a1f)
Solutions
- Set the attribute view's Spec to RichTextSpec (9) before persisting rich-text values — normally done automatically by upgradeSpec9 during load/save.
- Remove or convert the rich-text values (Format kramdown -> plain) if the view must stay on the old spec.
- Re-generate the .av file from a consistent source (its document tree) instead of merging specs by hand.
- If this appears while writing code, ensure custom serialization paths call av.CheckSpec before save and upgrade the spec via the provided fix helpers.
Example fix
// before
av.Spec = 8
av.Values["k1"].Text = &av.ValueText{ValueTextRichSpec: 9, Format: av.ValueTextRichFormatKramdown}
// after
av.Spec = av.RichTextSpec // 9, matches the rich text content
// or: strip rich text before saving on an old spec Defensive patterns
Strategy: validation
Validate before calling
func hasRichTextAtOldSpec(v *av.AttributeView) bool {
return v.Spec < av.RichTextSpec && v.HasRichText()
} Try / catch
if err := av.CheckSpec(v); errors.Is(err, av.ErrRichTextSpecMismatch) {
// upgrade spec or strip rich text before saving
} Prevention
- Always run CheckSpec before saving .av JSON
- Never hand-edit the spec field; let upgradeSpec9 handle upgrades
- Avoid merging .av files from different versions manually
When it happens
Trigger: Calling av.CheckSpec on an AttributeView with Spec < 9 and at least one text value with Format == ValueTextRichFormatKramdown (av_fix.go:60); deserializing/hand-editing a .av file whose spec was lowered; tests like TestUpgradeSpec9OnlyForRichText exercise this branch.
Common situations: A .av file was produced by a newer version (which upgrades Spec to 9 for rich text) but then partially reverted or hand-edited to an older spec; a sync conflict merged a rich-text value into an old-spec file; manual migration tooling lowered the spec.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- ErrSpecTooNew
- unsupported attribute view rich text spec [%d]
- attribute view not found
- ErrFilterTooDeep
- attribute view custom colors count exceeds the %d item limit
AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11).
Data as JSON: /api/errors/3bcbc756ef44b9df.
Report an issue: GitHub.