{"record":{"id":"e56eb7cbdb869eff","repo":"tinyhumansai/openhuman","slug":"clearallappdata-storage-clear-failed","errorCode":null,"errorMessage":"[clearAllAppData] storage clear failed:","messagePattern":"\\[clearAllAppData\\] storage clear failed:","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/src/utils/clearAllAppData.ts","lineNumber":45,"sourceCode":"      const prefix = `${userId}:`;\n      const toRemove: string[] = [];\n      for (let i = 0; i < localStorage.length; i++) {\n        const key = localStorage.key(i);\n        if (key && key.startsWith(prefix)) {\n          toRemove.push(key);\n        }\n      }\n      for (const key of toRemove) {\n        localStorage.removeItem(key);\n      }\n      localStorage.removeItem(ACTIVE_USER_KEY);\n    } else {\n      // No known user (pre-login recovery) — fall back to clearing everything\n      // so we don't leave orphaned blobs with no way to scope the deletion.\n      localStorage.clear();\n    }\n  } catch (err) {\n    console.warn('[clearAllAppData] storage clear failed:', err);\n  } finally {\n    try {\n      sessionStorage.clear();\n    } catch {\n      // best-effort\n    }\n  }\n}\n\ninterface ClearAllAppDataOptions {\n  // Optional core-side session clear (e.g. `auth_clear_session`). Best-effort —\n  // skipped silently if the caller cannot/does not provide it (e.g. pre-login\n  // recovery from a corrupt key file, where there is no live session).\n  clearSession?: () => Promise<unknown>;\n  // User scope passed to the CEF profile purge so per-user browser data is\n  // queued for deletion on the next launch. `null` purges the unauthenticated\n  // default profile.\n  userId?: string | null;","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/app/src/utils/clearAllAppData.ts#L27-L63","documentation":"Clearing user-scoped localStorage entries during a full app-data wipe threw — either the prefix-scoped per-user removal loop or the whole-store localStorage.clear() fallback (pre-login recovery path) failed. The catch aborts the remaining cleanup steps in clearAllAppData, so other stores (caches, sessionStorage, etc.) may survive and leave orphaned data behind.","triggerScenarios":"Thrown at app/src/utils/clearAllAppData.ts:45 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}