{"record":{"id":"a0bf021cfa78a887","repo":"tinyhumansai/openhuman","slug":"userefetchsnapshotonturnend-failed-to-refetch-us","errorCode":null,"errorMessage":"[useRefetchSnapshotOnTurnEnd] failed to refetch user state:","messagePattern":"\\[useRefetchSnapshotOnTurnEnd\\] failed to refetch user state:","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/src/hooks/useRefetchSnapshotOnTurnEnd.ts","lineNumber":39,"sourceCode":"      }\n    };\n  }, []);\n\n  const refetch = useCallback(() => {\n    if (debounceTimerRef.current !== null) {\n      window.clearTimeout(debounceTimerRef.current);\n    }\n\n    debounceTimerRef.current = window.setTimeout(() => {\n      debounceTimerRef.current = null;\n\n      // Fire-and-forget on a microtask\n      void (async () => {\n        try {\n          const user = await userApi.getMe();\n          patchSnapshot({ currentUser: user });\n        } catch (error) {\n          console.warn('[useRefetchSnapshotOnTurnEnd] failed to refetch user state:', error);\n        }\n      })();\n    }, 750);\n  }, [patchSnapshot]);\n\n  return { refetch };\n}\n","sourceCodeStart":21,"sourceCodeEnd":47,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/app/src/hooks/useRefetchSnapshotOnTurnEnd.ts#L21-L47","documentation":"Fire-and-forget warning in useRefetchSnapshotOnTurnEnd: after a debounced 750ms window following a turn end, a userApi.getMe() refresh rejected. Because this is a best-effort snapshot patch, the catch only logs — the stale currentUser snapshot stays until the next successful refetch or full reload; the chat turn itself is unaffected.","triggerScenarios":"Thrown at app/src/hooks/useRefetchSnapshotOnTurnEnd.ts:39 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["No user-facing action needed — next refetch or reload corrects the snapshot","If persistent, check session expiry and trigger re-auth","Debounce-unrelated retries can piggyback on the next turn-end event"],"exampleFix":null,"handlingStrategy":"try-catch","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"}