tinyhumansai/openhuman · error · Error

Not running in Tauri

Error message

Not running in Tauri

What it means

This throw comes from `ensureTauri()`, the shared precondition helper in taskSources.ts used by every task-source CRUD wrapper (`openhumanTaskSourcesList`, `openhumanTaskSourcesGet`, and the rest of that family). One central guard covers the whole surface: `isTauri()` false — plain browser, jsdom test, or the CEF bootstrap gap where `window.__TAURI_INTERNALS__.invoke` is not yet a function — means the local core RPC relay is unreachable, so each wrapper throws before sending its `openhuman.task_sources_*` request.

Source

Thrown at app/src/utils/tauriCommands/taskSources.ts:131

  connectionId?: string;
  /** Executor routing (G7): personality/skill/agent handle to pre-assign. */
  assignedExecutor?: string;
}

export interface TaskSourceAddParams {
  provider: TaskSourceProvider;
  filter: TaskSourceFilter;
  name?: string;
  connection_id?: string;
  interval_secs?: number;
  target?: TaskSourceTarget;
  max_tasks_per_fetch?: number;
  assigned_executor?: string;
}

function ensureTauri(): void {
  if (!isTauri()) {
    throw new Error('Not running in Tauri');
  }
}

export async function openhumanTaskSourcesList(): Promise<TaskSource[]> {
  ensureTauri();
  return await callCoreRpc<TaskSource[]>({ method: 'openhuman.task_sources_list' });
}

export async function openhumanTaskSourcesGet(id: string): Promise<TaskSource> {
  ensureTauri();
  return await callCoreRpc<TaskSource>({ method: 'openhuman.task_sources_get', params: { id } });
}

export async function openhumanTaskSourcesAdd(params: TaskSourceAddParams): Promise<TaskSource> {
  ensureTauri();
  return await callCoreRpc<TaskSource>({
    method: 'openhuman.task_sources_add',
    params: params as unknown as Record<string, unknown>,

View on GitHub (pinned to 7491200858)

Solutions

  1. Develop and verify task-source management inside the desktop shell (`pnpm dev:app`).
  2. Skip the initial list fetch and render an empty/desktop-only state when `!isTauri()`.
  3. Mock `isTauri` true and stub `callCoreRpc` (or mock the whole taskSources module) in tests.
  4. Catch at the data-loading effect and degrade gracefully rather than surfacing the throw.
  5. If task sources must be managed against a remote core from the web, relax `ensureTauri()` to also allow an active transport (it is only needed for the local relay), keeping the helper for shell-only commands.

Example fix

// before
useEffect(() => {
  openhumanTaskSourcesList().then(setSources);
}, []);

// after
useEffect(() => {
  if (!isTauri()) {
    setSources([]); // web preview: task-source RPC needs the desktop shell
    return;
  }
  openhumanTaskSourcesList().then(setSources).catch(console.error);
}, []);
Defensive patterns

Strategy: validation

Validate before calling

import { isTauri } from '../utils/tauriCommands/common';

if (!isTauri()) {
  setSources([]); // task-source CRUD all goes through ensureTauri()
  return;
}
const sources = await openhumanTaskSourcesList();

Type guard

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

Try / catch

try {
  const sources = await openhumanTaskSourcesList();
} catch (e) {
  if (e instanceof Error && e.message === 'Not running in Tauri') {
    setDesktopOnly(true);
    return;
  }
  throw e;
}

Prevention

When it happens

Trigger: Opening the task sources settings page (which immediately calls `openhumanTaskSourcesList()`) in the Vite browser preview; any subsequent get/create/update/delete of a task source in web mode; unit tests of task-source components with the default non-Tauri mock environment; a page load whose initial list call races the CEF bridge injection.

Common situations: Browser-first development of the integrations/task-sources screens; jsdom tests producing this rejection from the initial list effect; web previews or Storybook harnesses that mount the settings page.

Related errors


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