siyuan-note/siyuan · error
unsupported inline styles version [%d]
Error message
unsupported inline styles version [%d]
What it means
setInlineStylesData pins the on-disk/in-memory styles to InlineStylesVersion. If styles.Version differs, it rejects the whole payload rather than guessing how to migrate or interpret an older/newer schema. This protects the merge logic (normalizeInlineStyles plus custom-color usage reconciliation) from operating on fields whose meaning changed between versions.
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 8641553a1f)
Solutions
- Check InlineStylesVersion in kernel/model/inline_style.go and set styles.Version to that value before calling
- Migrate the older file's fields to the current schema instead of passing it through unchanged
- Restore a styles file produced by the same kernel version
- If the file is untrusted/unknown, start from newEmptyInlineStyleAV() and re-add palette entries manually
Example fix
// before
styles := &InlineStyles{Version: 1, Styles: parsed} // stale version
ret, _, err := SetInlineStyles(styles) // unsupported inline styles version [1]
// after
styles := &InlineStyles{Version: InlineStylesVersion, Styles: parsed}
ret, _, err := SetInlineStyles(styles) Defensive patterns
Strategy: validation
Validate before calling
if styles.Version != model.InlineStylesVersion {
return fmt.Errorf("cannot write styles version %d, expected %d", styles.Version, model.InlineStylesVersion)
} Try / catch
ret, _, err := model.SetInlineStyles(styles)
if err != nil && strings.Contains(err.Error(), "unsupported inline styles version") {
// re-derive payload at the current version or start from a fresh palette
} Prevention
- Always construct InlineStyles with Version: InlineStylesVersion rather than hard-coding a number
- After kernel upgrades, migrate or regenerate old palette files instead of re-saving them verbatim
- Version-check files restored from backups before loading them into a newer workspace
When it happens
Trigger: Passing an InlineStyles value whose Version field is stale (older workspace after a SiYuan upgrade) or from a newer kernel version; hand-copying an inline-styles structure without bumping/aligning Version; restoring a backup of the styles file from an incompatible version.
Common situations: Downgrading SiYuan after the palette schema advanced; syncing an inline-styles file between workspaces opened by different kernel versions; test fixtures copied from another version.
Related errors
AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11).
Data as JSON: /api/errors/fb09687ab429cc6a.
Report an issue: GitHub.