NousResearch/hermes-agent · error

Theme is missing required colors.

Error message

Theme is missing required colors.

What it means

Thrown by installUserTheme when isValidTheme(theme) fails — the theme object lacks the required color entries. Before persisting to the $userThemes atom and localStorage, the installer verifies the theme carries the mandatory color palette; a structurally present but incomplete theme (missing key colors) is rejected.

Source

Thrown at apps/desktop/src/themes/user-themes.ts:96

function persist(record: Record<string, DesktopTheme>) {
  try {
    window.localStorage.setItem(USER_THEMES_KEY, JSON.stringify(record))
  } catch {
    // Best-effort: a restricted storage context shouldn't break theming.
  }
}

/** Reactive map of installed user themes, keyed by slug. */
export const $userThemes = atom<Record<string, DesktopTheme>>(typeof window === 'undefined' ? {} : readStored())

/** Install (or replace) a user theme. Returns the stored theme. */
export function installUserTheme(theme: DesktopTheme): DesktopTheme {
  if (BUILTIN_THEMES[theme.name]) {
    throw new Error(`"${theme.name}" collides with a built-in theme.`)
  }

  if (!isValidTheme(theme)) {
    throw new Error('Theme is missing required colors.')
  }

  const next = { ...$userThemes.get(), [theme.name]: theme }
  $userThemes.set(next)
  persist(next)

  return theme
}

/** Remove a user theme by slug. No-op for unknown / built-in names. */
export function removeUserTheme(name: string): void {
  const current = $userThemes.get()

  if (!current[name]) {
    return
  }

  const next = { ...current }

View on GitHub (pinned to c896c09c42)

Solutions

  1. Run isValidTheme(theme) yourself and log which required colors are missing before installing.
  2. Fill in the missing required color fields in the theme JSON (backgrounds, foregrounds, accents per DesktopTheme's contract).
  3. If the theme came from a VS Code conversion, re-check the source file actually has a 'colors' map.

Example fix

// before
installUserTheme(partialTheme)

// after
if (!isValidTheme(theme)) { /* report missing colors, then fix theme JSON */ }
installUserTheme(theme)
Defensive patterns

Strategy: validation

Validate before calling

import { isValidTheme } from '.../themes/user-themes'

if (!isValidTheme(theme)) {
  // list missing required colors and block install
}

Type guard

function isCompleteTheme(t: unknown): t is DesktopTheme {
  return isValidTheme(t as DesktopTheme)
}

Try / catch

try {
  installUserTheme(theme)
} catch (e) {
  if (e instanceof Error && e.message === 'Theme is missing required colors.')
    showValidationErrors(collectMissingColors(theme))
  else throw e
}

Prevention

When it happens

Trigger: Calling installUserTheme with a hand-written or converted theme object whose colors map omits required keys — typically a VS Code conversion that produced an empty palette, or a partial JSON theme file.

Common situations: Installing a hand-edited theme JSON with truncated colors, or a theme built from a VS Code extension whose colors map was absent (upstream errors surface here if convertVscodeColorTheme's output is misused).

Related errors


AI-assisted analysis of NousResearch/hermes-agent@c896c09c42 (2026-08-14). Data as JSON: /api/errors/a5d6a13bb5357256. Report an issue: GitHub.