siyuan-note/siyuan · error

invalid hidden builtin style ID

Error message

invalid hidden builtin style ID [%s]

What it means

Hidden builtin style IDs must each match a known entry in builtinStyleOrder. Any value that is empty after trimming, misspelled, or belongs to an older/renamed style set is rejected with this error so the hidden-styles configuration only references real builtin styles.

Solutions

  1. Use only IDs that appear in the current builtinStyleOrder list (check the builtin style names shown in the editor style menu)
  2. Remove or correct the offending ID in the hidden builtin style IDs configuration
  3. If upgrading from an older version, drop the stale IDs and re-hide styles via the UI

Example fix

// before
hiddenBuiltinStyleIDs: ["bold", "itallic"]
// after
hiddenBuiltinStyleIDs: ["bold", "italic"]
Defensive patterns

Strategy: validation

Validate before calling

function validHiddenStyleIDs(ids, known) {
  return ids.every(id => known.includes(id.trim()) && id.trim() !== "");
}

Prevention

When it happens

Trigger: Saving the configuration listing hidden builtin styles with an ID not present in builtinStyleOrder — e.g. a typo, an empty string, or an ID from a previous version whose builtin styles were renamed or removed.

Common situations: Manual edits to conf.json; configs copied between workspaces/versions where the builtin style list changed; plugins writing style IDs from their own hardcoded lists.

Related errors


AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/bcec4d4c03e42653. Report an issue: GitHub.

Appendix: 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 9f775e8a12)