tinyhumansai/openhuman · info
Restart Core is only available in the desktop app.
Error message
Restart Core is only available in the desktop app.
What it means
Thrown by restartCoreProcess() when isTauri() is false. Restarting the embedded core is a Tauri IPC command ('restart_core_process') on the desktop shell — in a web preview or the Vitest harness there is no core process and no IPC bridge, so the function refuses instead of calling a nonexistent command. The module deliberately uses safeInvoke, but this guard fires before any invoke attempt.
Solutions
- Run inside the desktop shell (`pnpm dev:app` or the installed app) when you actually need to restart the core.
- Gate the UI: hide/disable the Restart Core control when !isTauri().
- In unit tests, mock '../utils/tauriCommands/common' so isTauri() returns true (or assert the throw explicitly for web behavior).
Example fix
// before
<button onClick={() => restartCoreProcess()}>Restart Core</button>
// after
{isTauri()
? <button onClick={() => restartCoreProcess()}>Restart Core</button>
: <span>Core restart is available in the desktop app.</span>} Defensive patterns
Strategy: type-guard
Validate before calling
import { isTauri } from '../utils/tauriCommands/common';
const canRestartCore = isTauri();
if (!canRestartCore) {
// hide/disable the Restart Core control — calling it will throw in web contexts
} Try / catch
try {
await restartCoreProcess();
} catch (e) {
if (e instanceof Error && e.message === 'Restart Core is only available in the desktop app.') {
setNotice('Core restart requires the desktop app.');
} else throw e;
} Prevention
- Gate restart controls on isTauri() at render time.
- Use `pnpm dev:app` (not `pnpm dev`) when testing core lifecycle features.
- Mock isTauri in Vitest when the code path under test calls restartCoreProcess.
When it happens
Trigger: Calling restartCoreProcess() from `pnpm dev` (Vite-only browser session), a web-only build, or a unit test without a Tauri mock; UI surfaces (settings buttons) reachable in non-Tauri contexts without an isTauri gate.
Common situations: Settings/troubleshooting screens tested in the browser dev server; Storybook or component tests rendering the restart button; e2e harnesses that load the UI outside the Tauri shell.
Related errors
- Model testing is only available in the desktop app.
- NOT_DESKTOP
- Core RPC token unavailable in Tauri; local RPC auth cannot…
- Not running in Tauri
- Not running in Tauri
AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17).
Data as JSON: /api/errors/125cfe93b2bc6e31.
Report an issue: GitHub.
Appendix: source
Thrown at app/src/services/coreProcessControl.ts:18
/**
* Thin wrapper around the Tauri `restart_core_process` IPC command.
*
* Surfaced via the Home blocking screen's "Restart Core" button (#1527) so
* the user has a one-click recovery when the local sidecar has crashed or
* is stuck. Outside Tauri (web preview / Vitest harness) this is a no-op
* that returns a friendly error string.
*/
// `safeInvoke` (in place of `@tauri-apps/api/core::invoke`) converts the CEF
// `window.ipc.postMessage` synchronous throw — Sentry TAURI-REACT-7 /
// TAURI-REACT-6 — into a rejected Promise so the caller's `await` /
// `.catch(...)` can handle it instead of bubbling as an unhandled rejection.
import { safeInvoke as invoke, isTauri } from '../utils/tauriCommands/common';
import { clearCoreRpcTokenCache } from './coreRpcClient';
export async function restartCoreProcess(): Promise<void> {
if (!isTauri()) {
throw new Error('Restart Core is only available in the desktop app.');
}
await invoke('restart_core_process');
// The Tauri shell mints a fresh `OPENHUMAN_CORE_TOKEN` for the new core
// process. Drop the cached bearer so token-bearing long-lived consumers
// (e.g. webhook SSE, see #1922) reconnect with the new value.
clearCoreRpcTokenCache();
}
View on GitHub (pinned to 7491200858)