From 9a0a6214cf9b299ad3f50a278767e42fc627fbaf Mon Sep 17 00:00:00 2001 From: Basit Mustafa Date: Tue, 5 May 2026 10:16:00 -0700 Subject: [PATCH] fix: guard localStorage.setItem('hermes-webui-model') against QuotaExceededError On some setups the localStorage quota is exhausted; the bare setItem call throws an unhandled DOMException that breaks model selection and prevents the chat UI from loading. Wrap both call-sites (boot.js model-select onChange, onboarding.js _saveOnboardingDefaults) in try/catch so the error is logged to the console as a warning instead of surfacing as a fatal exception. Fixes: 'Failed to execute setItem on Storage: Setting the value of hermes-webui-model exceeded the quota.' --- static/boot.js | 2 +- static/onboarding.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/static/boot.js b/static/boot.js index 62f3c8ab..8767dd67 100644 --- a/static/boot.js +++ b/static/boot.js @@ -815,7 +815,7 @@ $('modelSelect').onchange=async()=>{ : {model:selectedModel,model_provider:null}; if(typeof closeModelDropdown==='function') closeModelDropdown(); if(typeof _writePersistedModelState==='function') _writePersistedModelState(modelState.model,modelState.model_provider); - else localStorage.setItem('hermes-webui-model', modelState.model); + else try{localStorage.setItem('hermes-webui-model',modelState.model)}catch{} await api('/api/session/update',{method:'POST',body:JSON.stringify({ session_id:S.session.session_id, workspace:S.session.workspace, diff --git a/static/onboarding.js b/static/onboarding.js index bd0f9650..85b71d4a 100644 --- a/static/onboarding.js +++ b/static/onboarding.js @@ -465,7 +465,7 @@ async function _saveOnboardingDefaults(){ if(ONBOARDING.status){ ONBOARDING.status.settings={...(ONBOARDING.status.settings||{}),password_enabled:!!saved.auth_enabled}; } - localStorage.setItem('hermes-webui-model',model); + try{localStorage.setItem('hermes-webui-model',model)}catch{} if($('modelSelect')) _applyModelToDropdown(model,$('modelSelect')); }