{"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/9f775e8a12daef8255556097396f9b2739078892/kernel/model/inline_style.go#L216-L252","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"// before\nstyles := &model.InlineStyles{Styles: myStyles}\n// after\nstyles := &model.InlineStyles{Version: model.InlineStylesVersion, Styles: myStyles}","handlingStrategy":"validation","validationCode":"if styles.Version != model.InlineStylesVersion {\n    return fmt.Errorf(\"client version %d != kernel version %d\", styles.Version, model.InlineStylesVersion)\n}","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"unsupported inline styles version\") {\n    // re-fetch current styles from the kernel and merge into a fresh document\n}","preventionTips":["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"],"tags":["versioning","inline-styles","schema"],"backgroundTag":"schema-validation-failed","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}