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

A deliberate environment guard in restartCoreProcess(): restarting the embedded core is only possible inside the Tauri desktop shell, because only the shell owns the core child process (core_process.rs). When isTauri() is false — plain browser preview (pnpm dev) or the Vitest harness — the function throws this friendly error instead of attempting an invoke that cannot work.

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 a221052e0d)

Solutions

  1. Guard the call site: only show/enable the Restart Core control when isTauri() is true
  2. For browser-based development, restart the dev core process externally instead (or relaunch pnpm dev:app)
  3. In tests, either assert the error message or mock the module

Example fix

// before
<Button onClick={() => restartCoreProcess()}>Restart Core</Button>

// after
{isTauri() && (
  <Button onClick={() => restartCoreProcess().catch(showError)}>Restart Core</Button>
)}
Defensive patterns

Strategy: validation

Validate before calling

import { isTauri } from '../utils/tauriCommands/common';
if (!isTauri()) {
  hideRestartCoreControl(); // browser preview / tests — the call cannot succeed
}

Try / catch

try {
  await restartCoreProcess();
} catch (e) {
  if (e instanceof Error && e.message.includes('desktop app')) {
    setNotice('Restart Core is unavailable outside the desktop app.');
  } else throw e;
}

Prevention

When it happens

Trigger: Calling restartCoreProcess() from the web preview opened via the Vite dev server, in unit tests, or in any non-Tauri embedding. The Tauri IPC command restart_core_process simply does not exist outside the shell.

Common situations: Developers exercising Settings/IPC flows in a browser; tests importing a component that mounts a Restart Core control; a menu item not hidden when running outside Tauri.

Related errors


AI-assisted analysis of tinyhumansai/openhuman@a221052e0d (2026-08-16). Data as JSON: /api/errors/125cfe93b2bc6e31. Report an issue: GitHub.