siyuan-note/siyuan · error
invalid builtin style ID [%s]
Error message
invalid builtin style ID [%s]
What it means
A builtin style entry has an `id` that is not one of the four fixed builtin style IDs. builtinStyleOrder only accepts "error", "warning", "info", and "success"; any other ID (including empty after trimming whitespace) is invalid because builtin styles cannot be created or renamed by configuration.
Source
Thrown at kernel/model/inline_style.go:741
light, dark, err := normalizeInlineStyleThemePair(color.Light, color.Dark, fmt.Sprintf("builtin color [%d]", color.Index))
if err != nil {
return nil, err
}
ret.Colors = append(ret.Colors, &InlineStyleBuiltinColor{Index: color.Index, Light: light, Dark: dark})
}
sort.Slice(ret.Colors, func(i, j int) bool {
return ret.Colors[i].Index < ret.Colors[j].Index
})
styleIDs := make(map[string]struct{}, len(builtin.Styles))
for _, style := range builtin.Styles {
if style == nil {
return nil, errors.New("builtin style must not be null")
}
id := strings.TrimSpace(style.ID)
if _, valid := builtinStyleOrder[id]; !valid {
return nil, fmt.Errorf("invalid builtin style ID [%s]", id)
}
if _, exists := styleIDs[id]; exists {
return nil, fmt.Errorf("duplicate builtin style ID [%s]", id)
}
styleIDs[id] = struct{}{}
light, dark, err := normalizeInlineStyleThemePair(style.Light, style.Dark, "builtin style ["+id+"]")
if err != nil {
return nil, err
}
ret.Styles = append(ret.Styles, &InlineStyleBuiltinStyle{ID: id, Light: light, Dark: dark})
}
sort.Slice(ret.Styles, func(i, j int) bool {
return builtinStyleOrder[ret.Styles[i].ID] < builtinStyleOrder[ret.Styles[j].ID]
})
if builtin.Hidden != nil {
if ret.Hidden.Color, err = normalizeHiddenBuiltinColorIndexes(builtin.Hidden.Color, "color"); err != nil {View on GitHub (pinned to 8641553a1f)
Solutions
- Change the id to one of the exact strings "error", "warning", "info", or "success" (lowercase).
- If you intended a custom style, move the entry out of builtin.styles into the regular inline styles list, which allows arbitrary IDs.
- Remove the entry if it references a builtin style that no longer exists in your kernel version.
Example fix
// before
{"id": "Warning", "light": {...}, "dark": {...}}
// after
{"id": "warning", "light": {...}, "dark": {...}} Defensive patterns
Strategy: validation
Validate before calling
const BUILTIN_IDS = new Set(["error", "warning", "info", "success"]);
for (const s of config.builtin.styles) {
if (!BUILTIN_IDS.has((s.id || "").trim())) {
throw new Error(`invalid builtin style id: ${s.id}`);
}
} Prevention
- Builtin style IDs are a closed, lowercase set: error, warning, info, success — never invent new ones.
- Put custom styles in the regular inline styles list, not the builtin section.
When it happens
Trigger: setInlineStylesData or loadInlineStyles with builtin.styles containing `{"id": "caution", ...}`, `"id": ""`, or any id other than error/warning/info/success.
Common situations: Typo such as "erorr" or "Warning" (case-sensitive match); attempting to add a custom style in the builtin section instead of the custom inline-styles section; ID trimmed to empty by stray whitespace-only value; schema change across versions.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- builtin color must not be null
- duplicate builtin color index [%d]
- builtin style must not be null
- duplicate builtin style ID [%s]
- %s must define light and dark themes
AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11).
Data as JSON: /api/errors/850e513c09674036.
Report an issue: GitHub.