siyuan-note/siyuan · error
invalid hidden builtin style ID [%s]
Error message
invalid hidden builtin style ID [%s]
What it means
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.
Source
Thrown at kernel/model/inline_style.go:839
return nil, fmt.Errorf("hidden builtin %s index [%d] must be between %d and %d", field, index,
minBuiltinColorIndex, maxIndex)
}
if _, exists := seen[index]; exists {
continue
}
seen[index] = struct{}{}
ret = append(ret, index)
}
sort.Ints(ret)
return ret, nil
}
func normalizeHiddenBuiltinStyleIDs(ids []string) (ret []string, err error) {
seen := make(map[string]struct{}, len(ids))
for _, value := range ids {
id := strings.TrimSpace(value)
if _, valid := builtinStyleOrder[id]; !valid {
return nil, fmt.Errorf("invalid hidden builtin style ID [%s]", id)
}
if _, exists := seen[id]; exists {
continue
}
seen[id] = struct{}{}
ret = append(ret, id)
}
sort.Slice(ret, func(i, j int) bool {
return builtinStyleOrder[ret[i]] < builtinStyleOrder[ret[j]]
})
return ret, nil
}
func normalizeInlineStyleTheme(theme *InlineStyleTheme) (ret *InlineStyleTheme, err error) {
ret = &InlineStyleTheme{}
if ret.Color, err = normalizeInlineStyleColor(theme.Color); err != nil {
return nil, fmt.Errorf("invalid color: %w", err)
}View on GitHub (pinned to 8641553a1f)
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.
Example fix
// before
conf.HiddenBuiltinStyles = []string{"bold", "strikethroug"} // typo
// after
conf.HiddenBuiltinStyles = []string{"bold", "strikethrough"} // valid builtinStyleOrder ID Defensive patterns
Strategy: validation
Validate before calling
function isKnownBuiltinStyleID(id) {
return BUILTIN_STYLE_IDS.includes(typeof id === "string" ? id.trim() : "");
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- invalid appearance ID
- %s must use the same fields in light and dark themes
- hidden builtin %s index [%d] must be between %d and %d
- invalid frontend capability ID: %s
- invalid agent permission mode
AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11).
Data as JSON: /api/errors/bcec4d4c03e42653.
Report an issue: GitHub.