siyuan-note/siyuan · error
unsupported inline styles version
Error message
unsupported inline styles version [%d]
What it means
The inline styles document is versioned; setInlineStylesData only accepts styles whose Version equals InlineStylesVersion. Any other version is rejected so the kernel never misinterprets an older or newer on-disk/in-flight format.
Solutions
- Check the InlineStylesVersion constant in kernel/model/inline_style.go and set styles.Version to that exact value.
- Re-read the styles document from the current running kernel rather than from stale files produced by another version.
- If the data comes from a newer SiYuan version, upgrade the kernel instead of downgrading the data.
Example fix
// before
styles := &model.InlineStyles{Styles: myStyles}
// after
styles := &model.InlineStyles{Version: model.InlineStylesVersion, Styles: myStyles} Defensive patterns
Strategy: validation
Validate before calling
if styles.Version != model.InlineStylesVersion {
return fmt.Errorf("client version %d != kernel version %d", styles.Version, model.InlineStylesVersion)
} Try / catch
if err != nil && strings.Contains(err.Error(), "unsupported inline styles version") {
// re-fetch current styles from the kernel and merge into a fresh document
} Prevention
- Never hardcode version numbers; read InlineStylesVersion from the kernel constants
- Do not copy styles files between workspaces of different SiYuan versions
- When reading styles from disk, validate Version before mutating and re-saving
When it happens
Trigger: Posting SetInlineStyles/SetInlineStylesData with a Version field that is not InlineStylesVersion (e.g. data written by a newer SiYuan version, hand-edited JSON, or a payload constructed without setting Version, leaving it 0).
Common situations: Rolling back the app to an older build after a newer version bumped InlineStylesVersion; a plugin copying a styles file from a different workspace version; constructing InlineStyles programmatically and forgetting to set Version.
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
- invalid bazaar index schema
- unsupported AI editor actions version
- unsupported hpath refresh version
- attribute view custom color
- builtin color must not be null
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/fb09687ab429cc6a.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/inline_style.go:234
for _, index := range current.Builtin.Hidden.AV {
if index != patch.Index {
filteredHidden = append(filteredHidden, index)
}
}
current.Builtin.Hidden.AV = filteredHidden
if patch.Hidden {
current.Builtin.Hidden.AV = append(current.Builtin.Hidden.AV, patch.Index)
}
}
return setInlineStylesData(current, currentAV)
}
func setInlineStylesData(styles *InlineStyles, currentAV *InlineStyleAV) (ret *InlineStyles, changed bool, err error) {
if styles == nil {
return nil, false, errors.New("inline styles must not be null")
}
if styles.Version != InlineStylesVersion {
return nil, false, fmt.Errorf("unsupported inline styles version [%d]", styles.Version)
}
if currentAV == nil {
currentAV = newEmptyInlineStyleAV()
}
normalizedStyles, err := normalizeInlineStyles(styles.Styles, true)
if err != nil {
return nil, false, err
}
normalizedBuiltin, err := normalizeInlineStyleBuiltin(styles.Builtin)
if err != nil {
return nil, false, err
}
normalizedAV, err := normalizeInlineStyleAV(styles.AV, true)
if err != nil {
return nil, false, err
}
ret = &InlineStyles{View on GitHub (pinned to 9f775e8a12)