{"record":{"id":"c821acd5ebc34e92","repo":"siyuan-note/siyuan","slug":"duplicate-builtin-style-id-s","errorCode":null,"errorMessage":"duplicate builtin style ID [%s]","messagePattern":"duplicate builtin style ID \\[(.+?)\\]","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/inline_style.go","lineNumber":744,"sourceCode":"\t\t\treturn nil, err\n\t\t}\n\t\tret.Colors = append(ret.Colors, &InlineStyleBuiltinColor{Index: color.Index, Light: light, Dark: dark})\n\t}\n\tsort.Slice(ret.Colors, func(i, j int) bool {\n\t\treturn ret.Colors[i].Index < ret.Colors[j].Index\n\t})\n\n\tstyleIDs := make(map[string]struct{}, len(builtin.Styles))\n\tfor _, style := range builtin.Styles {\n\t\tif style == nil {\n\t\t\treturn nil, errors.New(\"builtin style must not be null\")\n\t\t}\n\t\tid := strings.TrimSpace(style.ID)\n\t\tif _, valid := builtinStyleOrder[id]; !valid {\n\t\t\treturn nil, fmt.Errorf(\"invalid builtin style ID [%s]\", id)\n\t\t}\n\t\tif _, exists := styleIDs[id]; exists {\n\t\t\treturn nil, fmt.Errorf(\"duplicate builtin style ID [%s]\", id)\n\t\t}\n\t\tstyleIDs[id] = struct{}{}\n\n\t\tlight, dark, err := normalizeInlineStyleThemePair(style.Light, style.Dark, \"builtin style [\"+id+\"]\")\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tret.Styles = append(ret.Styles, &InlineStyleBuiltinStyle{ID: id, Light: light, Dark: dark})\n\t}\n\tsort.Slice(ret.Styles, func(i, j int) bool {\n\t\treturn builtinStyleOrder[ret.Styles[i].ID] < builtinStyleOrder[ret.Styles[j].ID]\n\t})\n\n\tif builtin.Hidden != nil {\n\t\tif ret.Hidden.Color, err = normalizeHiddenBuiltinColorIndexes(builtin.Hidden.Color, \"color\"); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif ret.Hidden.BackgroundColor, err = normalizeHiddenBuiltinColorIndexes(builtin.Hidden.BackgroundColor,","sourceCodeStart":726,"sourceCodeEnd":762,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/model/inline_style.go#L726-L762","documentation":"Two entries in the builtin styles array share the same ID (after trimming whitespace). The four builtin style IDs must each appear at most once because they are keys into the fixed error/warning/info/success set and their order is defined by builtinStyleOrder.","triggerScenarios":"setInlineStylesData or loadInlineStyles with builtin.styles containing two entries whose trimmed ids match, e.g. two `{\"id\": \"info\"}` entries.","commonSituations":"Duplicated JSON object from copy-paste; merging configs from two sources without de-duplication; a script iterating a list that already contained the style and appending it again.","solutions":["Delete the duplicate entry for that builtin style ID in inline-styles.json or the API payload.","If the two entries differ, keep the desired one and merge its theme values into the single surviving entry.","Add a de-dup step (map keyed by trimmed ID) in any tooling that writes the builtin styles array."],"exampleFix":"// before\n[{\"id\": \"info\", ...}, {\"id\": \"info\", ...}]\n// after\n[{\"id\": \"info\", ...}]","handlingStrategy":"validation","validationCode":"const ids = config.builtin.styles.map(s => (s.id || \"\").trim());\nif (new Set(ids).size !== ids.length) {\n  throw new Error(\"duplicate builtin style id\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["De-duplicate by trimmed ID before writing the builtin styles array.","Each of the four builtin styles should appear at most once; prefer updating an existing entry over appending."],"tags":["go","configuration","inline-styles","duplicate-key"],"backgroundTag":"invalid-config-value","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"}