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
Opening the Settings dialog and navigating to the Web Search section causes an immediate runtime crash:
TypeError: Cannot read properties of undefined (reading 'icon')
at getHeaderContent (components/settings/index.tsx:545:25)
The root cause is that WEB_SEARCH_PROVIDERS[selectedWebSearchProviderId] returns undefined when selectedWebSearchProviderId holds an ID that no longer exists in the WEB_SEARCH_PROVIDERS registry.
After switching back to main (which doesn't have that provider), the stale provider ID remains in localStorage
Open the app → click the Web Search settings → crash
This will also affect any user who:
Upgrades to a version where a previously available provider has been removed
Manually edits localStorage
Switches between branches with different provider sets during development
Affected provider types
The same unsafe lookup pattern (PROVIDERS[id] without null check) exists for all provider types:
Provider type
Store field
Lookup map
Crash site
Web Search
webSearchProviderId
WEB_SEARCH_PROVIDERS
settings/index.tsx:542 ✅ confirmed crash
PDF
pdfProviderId
PDF_PROVIDERS
settings/index.tsx:522⚠️ same pattern
Image
imageProviderId
IMAGE_PROVIDERS
already uses ?. — safe
Video
videoProviderId
VIDEO_PROVIDERS
already uses ?. — safe
TTS
ttsProviderId
TTS_PROVIDERS
already uses ?. — safe
ASR
asrProviderId
ASR_PROVIDERS
already uses ?. — safe
LLM provider (providerId + modelId) is not affected because it already has auto-select / fallback logic in fetchServerProviders.
Proposed fix
Store layer (lib/store/settings.ts): validate persisted provider IDs during rehydration; reset any invalid ID to its default value
UI layer (components/settings/index.tsx): add null guards for PDF_PROVIDERS[selectedPdfProviderId] and WEB_SEARCH_PROVIDERS[selectedWebSearchProviderId] in getHeaderContent()
This should be a small, self-contained fix (~20 lines).
Description
Opening the Settings dialog and navigating to the Web Search section causes an immediate runtime crash:
The root cause is that
WEB_SEARCH_PROVIDERS[selectedWebSearchProviderId]returnsundefinedwhenselectedWebSearchProviderIdholds an ID that no longer exists in theWEB_SEARCH_PROVIDERSregistry.How to reproduce
main(which doesn't have that provider), the stale provider ID remains inlocalStorageThis will also affect any user who:
localStorageAffected provider types
The same unsafe lookup pattern (
PROVIDERS[id]without null check) exists for all provider types:webSearchProviderIdWEB_SEARCH_PROVIDERSsettings/index.tsx:542✅ confirmed crashpdfProviderIdPDF_PROVIDERSsettings/index.tsx:522imageProviderIdIMAGE_PROVIDERS?.— safevideoProviderIdVIDEO_PROVIDERS?.— safettsProviderIdTTS_PROVIDERS?.— safeasrProviderIdASR_PROVIDERS?.— safeLLM provider (
providerId+modelId) is not affected because it already has auto-select / fallback logic infetchServerProviders.Proposed fix
lib/store/settings.ts): validate persisted provider IDs during rehydration; reset any invalid ID to its default valuecomponents/settings/index.tsx): add null guards forPDF_PROVIDERS[selectedPdfProviderId]andWEB_SEARCH_PROVIDERS[selectedWebSearchProviderId]ingetHeaderContent()This should be a small, self-contained fix (~20 lines).