earendil-works/pi · error · Error

Theme not found

Error message

Theme not found: ${name}

What it means

Thrown by loadThemeJson when the requested name is neither a built-in theme, a registered theme, nor a discoverable custom theme file in the custom themes directory. It is the final not-found guard in the theme resolution chain.

Solutions

  1. Check the theme name for typos and casing
  2. List available themes to see valid names
  3. Place the theme file as <name>.json in the custom themes directory or register it before use
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/coding-agent/src/modes/interactive/theme/theme.ts:623 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of earendil-works/pi@4af9d21d3b (2026-08-24). Data as JSON: /api/errors/5e7ca14ae42956cd. Report an issue: GitHub.

Appendix: source

Thrown at packages/coding-agent/src/modes/interactive/theme/theme.ts:623

}

function loadThemeJson(name: string): ThemeJson {
	const builtinThemes = getBuiltinThemes();
	if (name in builtinThemes) {
		return builtinThemes[name];
	}
	const registeredTheme = registeredThemes.get(name);
	if (registeredTheme?.sourcePath) {
		const content = fs.readFileSync(registeredTheme.sourcePath, "utf-8");
		return parseThemeJsonContent(registeredTheme.sourcePath, content);
	}
	if (registeredTheme) {
		throw new Error(`Theme "${name}" does not have a source path for export`);
	}
	const customThemesDir = getCustomThemesDir();
	const themePath = path.join(customThemesDir, `${name}.json`);
	if (!fs.existsSync(themePath)) {
		throw new Error(`Theme not found: ${name}`);
	}
	const content = fs.readFileSync(themePath, "utf-8");
	return parseThemeJsonContent(name, content);
}

function createTheme(themeJson: ThemeJson, mode?: ColorMode, sourcePath?: string): Theme {
	const colorMode = mode ?? (getCapabilities().trueColor ? "truecolor" : "256color");
	const resolvedColors = resolveThemeColors(withThemeColorFallbacks(themeJson.colors), themeJson.vars);
	const fgColors: Record<ThemeColor, string | number> = {} as Record<ThemeColor, string | number>;
	const bgColors: Record<ThemeBg, string | number> = {} as Record<ThemeBg, string | number>;
	const bgColorKeys: Set<string> = new Set([
		"selectedBg",
		"scrollbarThumb",
		"searchMatchBg",
		"userMessageBg",
		"customMessageBg",
		"toolPendingBg",
		"toolSuccessBg",

View on GitHub (pinned to 4af9d21d3b)