{"record":{"id":"3f3ced689eeb3623","repo":"tinyhumansai/openhuman","slug":"subconscious-setmode-failed","errorCode":null,"errorMessage":"[subconscious] setMode failed:","messagePattern":"\\[subconscious\\] setMode failed:","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/src/hooks/useSubconscious.ts","lineNumber":140,"sourceCode":"    } finally {\n      setTriggeringKinds(prev => {\n        const next = new Set(prev);\n        next.delete(kind);\n        return next;\n      });\n    }\n  }, []);\n\n  const setMode = useCallback(\n    async (newMode: SubconsciousMode) => {\n      if (!isTauri()) return;\n      setSettingMode(true);\n      setModeState(newMode);\n      try {\n        await openhumanHeartbeatSettingsSet({ subconscious_mode: newMode });\n        await refresh();\n      } catch (err) {\n        console.warn('[subconscious] setMode failed:', err);\n        setError(err instanceof Error ? err.message : 'Failed to update mode');\n      } finally {\n        setSettingMode(false);\n      }\n    },\n    [refresh]\n  );\n\n  const setIntervalMinutes = useCallback(async (minutes: number) => {\n    if (!isTauri()) return;\n    setIntervalState(minutes);\n    try {\n      await openhumanHeartbeatSettingsSet({ interval_minutes: minutes });\n    } catch (err) {\n      console.warn('[subconscious] setInterval failed:', err);\n    }\n  }, []);\n","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/app/src/hooks/useSubconscious.ts#L122-L158","documentation":"Failure of setMode in useSubconscious: the hook optimistically sets the local mode state, then persists via openhumanHeartbeatSettingsSet({subconscious_mode}) and refreshes; the RPC rejected. The catch warns and sets a user-readable error, but note the optimistic local state is NOT rolled back — UI and persisted config can diverge until the next refresh().","triggerScenarios":"Thrown at app/src/hooks/useSubconscious.ts:140 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Call refresh() after failure to re-sync local state from persisted config","Check core config-write permissions if the failure is persistent","Roll back the optimistic mode in the catch to avoid divergence"],"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-14T00:17:10.932Z"}