tinyhumansai/openhuman · error · Error

Not running in Tauri

Error message

Not running in Tauri

What it means

consciousLoopRun manually triggers a conscious-loop run by invoking the `conscious_loop_run` Tauri command directly (via safeInvoke) with authToken/backendUrl/model — unlike the core-RPC wrappers, this is a shell command, not an openhuman.* JSON-RPC method. The guard throws when isTauri() is false because Tauri commands cannot be invoked outside the webview shell; the file's header comment notes the intent is a rejected Promise rather than an escape to onunhandledrejection. safeInvoke additionally classifies CEF bridge failures as IpcUnavailableError, but the guard here fires before invoke is reached.

Source

Thrown at app/src/utils/tauriCommands/conscious.ts:19

/**
 * Conscious loop commands.
 */
// `safeInvoke` (aliased to `invoke`) replaces bare
// `@tauri-apps/api/core::invoke` so the CEF `window.ipc.postMessage`
// synchronous throw (Sentry TAURI-REACT-7 / TAURI-REACT-6) lands as a
// rejected Promise instead of escaping to `onunhandledrejection`.
import { safeInvoke as invoke, isTauri } from './common';

/**
 * Trigger a conscious loop run manually.
 */
export async function consciousLoopRun(
  authToken: string,
  backendUrl: string,
  model?: string
): Promise<void> {
  if (!isTauri()) {
    throw new Error('Not running in Tauri');
  }
  await invoke('conscious_loop_run', { authToken, backendUrl, model });
}

View on GitHub (pinned to a221052e0d)

Solutions

  1. Run the desktop dev host (`pnpm dev:app`) to exercise the conscious loop trigger.
  2. Gate the button/action on isTauri() and hide or disable it in browser mode.
  3. Catch the rejection and report 'available in the desktop app' instead of a raw error.
  4. In tests, mock the conscious module or @tauri-apps/api/core invoke.

Example fix

// before
await consciousLoopRun(authToken, backendUrl, model);

// after
if (!isTauri()) {
  showToast('Conscious loop runs inside the desktop app');
  return;
}
await consciousLoopRun(authToken, backendUrl, model);
Defensive patterns

Strategy: validation

Validate before calling

import { isTauri } from './common';

if (!isTauri()) {
  showToast('Conscious loop runs inside the desktop app');
  return;
}
await consciousLoopRun(authToken, backendUrl, model);

Type guard

function isNotRunningInTauriError(err: unknown): err is Error {
  return err instanceof Error && err.message === 'Not running in Tauri';
}

Try / catch

try {
  await consciousLoopRun(authToken, backendUrl, model);
} catch (err) {
  if (err instanceof Error && err.message === 'Not running in Tauri') return;
  if (err instanceof IpcUnavailableError) return; // CEF bridge gap
  throw err;
}

Prevention

When it happens

Trigger: Clicking a 'run conscious loop now' action while the UI runs under `pnpm dev`; invoking the helper from a Vitest test without mocking @tauri-apps/api/core; the action firing during the CEF bootstrap gap.

Common situations: Manual-trigger buttons developed/tested in browser mode; auth-token-bearing actions attempted outside the shell where no Tauri command registry exists.

Related errors


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