{"record":{"id":"028af2e54dd16884","repo":"tinyhumansai/openhuman","slug":"core-state-memory-client-sync-failed-after-sessi","errorCode":null,"errorMessage":"[core-state] memory client sync failed after session store:","messagePattern":"\\[core-state\\] memory client sync failed after session store:","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/src/providers/CoreStateProvider.tsx","lineNumber":708,"sourceCode":"      // un-caught `app_state_snapshot` timeout used to bubble out of\n      // `setEncryptionKey` / `setOnboardingTasks` callers as an unhandled\n      // rejection → OPENHUMAN-REACT-Z/Y. The next poll tick will reconcile.\n      await refresh().catch(err => {\n        log('refresh failed after updateLocalState: %O', sanitizeError(err));\n      });\n    },\n    [refresh]\n  );\n\n  const storeSessionToken = useCallback(\n    async (token: string, user?: object) => {\n      logoutGuardUntilRef.current = 0;\n      await storeSession(token, user ?? {});\n      try {\n        await syncMemoryClientToken(token);\n        memoryTokenRef.current = token;\n      } catch (error) {\n        console.warn('[core-state] memory client sync failed after session store:', error);\n      }\n      // refresh() drives refreshCore, which now owns identity-flip detection\n      // and dispatches handleIdentityFlip when both prev and next are\n      // authenticated and identities differ. The previous standalone\n      // restartApp call here was redundant and skipped the persist purge,\n      // letting redux-persist rehydrate the prior user's slices on launch\n      // (#900). Restart now happens inside handleIdentityFlip after purge.\n      // Swallow refresh failures here so a cold-boot `app_state_snapshot`\n      // timeout post-login doesn't surface as an unhandled rejection\n      // (OPENHUMAN-REACT-Z/Y) — the polling loop reconciles within\n      // `POLL_MS`.\n      await refresh().catch(err => {\n        log('refresh failed after session store: %O', sanitizeError(err));\n      });\n      if (!isLocalSessionToken(token)) {\n        await refreshTeams().catch(err => {\n          log('refreshTeams failed after session store: %O', sanitizeError(err));\n        });","sourceCodeStart":690,"sourceCodeEnd":726,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/app/src/providers/CoreStateProvider.tsx#L690-L726","documentation":"Syncing the memory client's auth token failed right after storing a session token in storeSessionToken: syncMemoryClientToken rejected for the newly issued token. The session itself is stored (storeSession already completed), but memory operations will not carry the new token — memory auth failures surface later until a refresh-cycle sync (which retries via the refresh path) succeeds.","triggerScenarios":"Thrown at app/src/providers/CoreStateProvider.tsx:708 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the warned error to identify the memory client sync failure layer","Sign out and back in to force a fresh token and a new sync attempt","Watch for memory feature errors in-session; the periodic refresh retries the token sync on its own","Persistent failures: inspect core memory service logs"],"exampleFix":null,"handlingStrategy":"retry","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-14T05:17:10.506Z"}