siyuan-note/siyuan · error

icon [%s] not exists or not available

Error message

icon [%s] not exists or not available

What it means

Returned by SetIcon when the requested icon name is not found in Conf.Appearance.Icons (the currently loaded/installed icon packs). Icons are populated by LoadIcons during InitAppearance; SetIcon compares by Name. Passing an icon that is not installed (or whose pack failed to load) is rejected before Conf.Appearance.Icon is mutated.

Source

Thrown at kernel/model/appearance.go:76

		Conf.Appearance.ThemeLight = "daylight"
		Conf.Appearance.ThemeJS = false
	}
	if !containIcon(Conf.Appearance.Icon, Conf.Appearance.Icons) {
		Conf.Appearance.Icon = "litheness"
	}
	Conf.m.Unlock()

	Conf.Save()

	util.InitEmojiChars()
}

func SetIcon(icon string) error {
	Conf.m.Lock()
	defer Conf.m.Unlock()

	if !containIcon(icon, Conf.Appearance.Icons) {
		return fmt.Errorf("icon [%s] not exists or not available", icon)
	}
	Conf.Appearance.Icon = icon
	return nil
}

func SetTheme(theme string, modes []int, appearanceMode string) error {
	Conf.m.Lock()
	defer Conf.m.Unlock()

	if theme != "" {
		for _, mode := range modes {
			switch mode {
			case 0:
				if !containTheme(theme, Conf.Appearance.LightThemes) {
					return fmt.Errorf("theme [%s] not exists or not available for light mode", theme)
				}
				Conf.Appearance.ThemeLight = theme
			case 1:

View on GitHub (pinned to 251596fc0d)

Solutions

  1. Install/keep the icon pack that provides the icon, then retry.
  2. List Conf.Appearance.Icons and pick a Name that is actually present (e.g. the default "litheness").
  3. Ensure SetIcon is only called after InitAppearance has loaded icons.

Example fix

// before
model.SetIcon("removed-pack")
// after
model.SetIcon("litheness")  // default, always present
Defensive patterns

Strategy: validation

Validate before calling

if !containIcon(name, Conf.Appearance.Icons) {
    return fmt.Errorf("icon %q not installed", name)
}

Type guard

func iconAvailable(name string, icons []*conf.AppearanceIcon) bool {
    for _, i := range icons { if i.Name == name { return true } }
    return false
}

Prevention

When it happens

Trigger: Calling SetIcon with a name that does not match any AppearanceIcon.Name — e.g. an icon pack that was uninstalled, a typo, or an icon referenced before LoadIcons ran.

Common situations: A user uninstalls an icon pack but config still references its name; calling SetIcon during startup before InitAppearance has populated Icons; a typo or localized name vs the canonical Name.

Related errors


AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12). Data as JSON: /api/errors/08f0e4a20b664584. Report an issue: GitHub.