You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tui: one malformed custom theme file silently disables all custom themes #44263
A single invalid themes/*.json file anywhere in the discovered .opencode directories disables every custom theme, not just the invalid one.
In packages/tui/src/context/theme.tsx, discoverThemes() parses each matched file with JSON.parse and no per-file error handling, so the first malformed file rejects the whole discovery pass. The rejection is then swallowed in syncCustomThemes() via catch(() => setStore("active", "opencode")): nothing is logged, previously working themes disappear from the picker, and the active theme silently resets to the default.
This diverges from the convention the tui config loader itself documents ("every broken-config path degrades gracefully rather than crashing" - see packages/opencode/src/config/tui.ts), where an unreadable or invalid file is skipped with a warning while the remaining valid files still apply.
Suggested direction: isolate each file's parse, skip and warn on failure instead of failing the entire batch.
Steps to reproduce
Create a valid custom theme at .opencode/themes/my-theme.json, select it in the TUI - works.
Add a second file .opencode/themes/broken.json whose content is just { (invalid JSON).
Restart the TUI (or trigger a theme refresh).
Both custom themes are now gone from the theme list and the active theme has silently fallen back to opencode. Fixing broken.json brings everything back.
Filed this after reproducing via JSON.parse rejection in discoverThemes (packages/tui/src/context/theme.tsx). PR #44586 fixes the exact root cause - per-file error isolation so one malformed theme file no longer poisons discovery of all valid ones. For context: an earlier fix attempt (#44365) was auto-closed by the compliance bot for missing template sections, before anyone could review it.
Activity
aniruddhaadak80 commentedon Aug 25, 2026
Filed this after reproducing via
JSON.parserejection indiscoverThemes(packages/tui/src/context/theme.tsx). PR #44586 fixes the exact root cause - per-file error isolation so one malformed theme file no longer poisons discovery of all valid ones. For context: an earlier fix attempt (#44365) was auto-closed by the compliance bot for missing template sections, before anyone could review it.