{"record":{"id":"bcec4d4c03e42653","repo":"siyuan-note/siyuan","slug":"invalid-hidden-builtin-style-id-s","errorCode":null,"errorMessage":"invalid hidden builtin style ID [%s]","messagePattern":"invalid hidden builtin style ID \\[(.+?)\\]","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/inline_style.go","lineNumber":839,"sourceCode":"\t\t\treturn nil, fmt.Errorf(\"hidden builtin %s index [%d] must be between %d and %d\", field, index,\n\t\t\t\tminBuiltinColorIndex, maxIndex)\n\t\t}\n\t\tif _, exists := seen[index]; exists {\n\t\t\tcontinue\n\t\t}\n\t\tseen[index] = struct{}{}\n\t\tret = append(ret, index)\n\t}\n\tsort.Ints(ret)\n\treturn ret, nil\n}\n\nfunc normalizeHiddenBuiltinStyleIDs(ids []string) (ret []string, err error) {\n\tseen := make(map[string]struct{}, len(ids))\n\tfor _, value := range ids {\n\t\tid := strings.TrimSpace(value)\n\t\tif _, valid := builtinStyleOrder[id]; !valid {\n\t\t\treturn nil, fmt.Errorf(\"invalid hidden builtin style ID [%s]\", id)\n\t\t}\n\t\tif _, exists := seen[id]; exists {\n\t\t\tcontinue\n\t\t}\n\t\tseen[id] = struct{}{}\n\t\tret = append(ret, id)\n\t}\n\tsort.Slice(ret, func(i, j int) bool {\n\t\treturn builtinStyleOrder[ret[i]] < builtinStyleOrder[ret[j]]\n\t})\n\treturn ret, nil\n}\n\nfunc normalizeInlineStyleTheme(theme *InlineStyleTheme) (ret *InlineStyleTheme, err error) {\n\tret = &InlineStyleTheme{}\n\tif ret.Color, err = normalizeInlineStyleColor(theme.Color); err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid color: %w\", err)\n\t}","sourceCodeStart":821,"sourceCodeEnd":857,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/model/inline_style.go#L821-L857","documentation":"Hidden built-in inline styles are identified by string IDs that must exist in the builtinStyleOrder table. When normalizing the saved list of hidden style IDs, any value (after trimming whitespace) that is not a known builtin ID is rejected with this error. This prevents orphaned or foreign identifiers from corrupting style configuration.","triggerScenarios":"Saving hidden builtin style configuration (normalizeHiddenBuiltinStyleIDs in kernel/model/inline_style.go) with an ID that is misspelled, comes from a removed builtin, or was hand-edited into the config JSON.","commonSituations":"Configs carried across SiYuan versions where a builtin style ID was renamed or removed; manual editing of the configuration file; scripts writing style IDs guessed from UI labels instead of the actual ID constants.","solutions":["Validate each ID against the current builtinStyleOrder set before persisting, dropping unknown IDs.","Update the config to use the current builtin style IDs if a rename happened in a newer version.","Trim and re-check the raw config JSON for typos or stray whitespace variants."],"exampleFix":"// before\nconf.HiddenBuiltinStyles = []string{\"bold\", \"strikethroug\"} // typo\n// after\nconf.HiddenBuiltinStyles = []string{\"bold\", \"strikethrough\"} // valid builtinStyleOrder ID","handlingStrategy":"validation","validationCode":"function isKnownBuiltinStyleID(id) {\n  return BUILTIN_STYLE_IDS.includes(typeof id === \"string\" ? id.trim() : \"\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Import builtin style IDs from constants rather than typing them as literals.","Drop unknown IDs with a warning instead of saving them.","Check release notes for builtin style ID renames when upgrading."],"tags":["validation","identifier","inline-style","config"],"backgroundTag":"invalid-identifier","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"}