{"record":{"id":"fb09687ab429cc6a","repo":"siyuan-note/siyuan","slug":"unsupported-inline-styles-version-d","errorCode":null,"errorMessage":"unsupported inline styles version [%d]","messagePattern":"unsupported inline styles version \\[(.+?)\\]","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/inline_style.go","lineNumber":234,"sourceCode":"\t\tfor _, index := range current.Builtin.Hidden.AV {\n\t\t\tif index != patch.Index {\n\t\t\t\tfilteredHidden = append(filteredHidden, index)\n\t\t\t}\n\t\t}\n\t\tcurrent.Builtin.Hidden.AV = filteredHidden\n\t\tif patch.Hidden {\n\t\t\tcurrent.Builtin.Hidden.AV = append(current.Builtin.Hidden.AV, patch.Index)\n\t\t}\n\t}\n\treturn setInlineStylesData(current, currentAV)\n}\n\nfunc setInlineStylesData(styles *InlineStyles, currentAV *InlineStyleAV) (ret *InlineStyles, changed bool, err error) {\n\tif styles == nil {\n\t\treturn nil, false, errors.New(\"inline styles must not be null\")\n\t}\n\tif styles.Version != InlineStylesVersion {\n\t\treturn nil, false, fmt.Errorf(\"unsupported inline styles version [%d]\", styles.Version)\n\t}\n\tif currentAV == nil {\n\t\tcurrentAV = newEmptyInlineStyleAV()\n\t}\n\n\tnormalizedStyles, err := normalizeInlineStyles(styles.Styles, true)\n\tif err != nil {\n\t\treturn nil, false, err\n\t}\n\tnormalizedBuiltin, err := normalizeInlineStyleBuiltin(styles.Builtin)\n\tif err != nil {\n\t\treturn nil, false, err\n\t}\n\tnormalizedAV, err := normalizeInlineStyleAV(styles.AV, true)\n\tif err != nil {\n\t\treturn nil, false, err\n\t}\n\tret = &InlineStyles{","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/model/inline_style.go#L216-L252","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nstyles := &InlineStyles{Version: 1, Styles: parsed} // stale version\nret, _, err := SetInlineStyles(styles) // unsupported inline styles version [1]\n// after\nstyles := &InlineStyles{Version: InlineStylesVersion, Styles: parsed}\nret, _, err := SetInlineStyles(styles)","handlingStrategy":"validation","validationCode":"if styles.Version != model.InlineStylesVersion {\n    return fmt.Errorf(\"cannot write styles version %d, expected %d\", styles.Version, model.InlineStylesVersion)\n}","typeGuard":null,"tryCatchPattern":"ret, _, err := model.SetInlineStyles(styles)\nif err != nil && strings.Contains(err.Error(), \"unsupported inline styles version\") {\n    // re-derive payload at the current version or start from a fresh palette\n}","preventionTips":["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"],"tags":["go","versioning","schema","attribute-view"],"backgroundTag":"unsupported-version","analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}