tinyhumansai/openhuman · error · Error

Not running in Tauri

Error message

Not running in Tauri

What it means

openhumanCronAdd creates a scheduled job (name/schedule/prompt plus optional model, agent_id, profile_id, delivery mode, delete_after_run) via the openhuman.cron_add core RPC over the Tauri bridge. The guard rejects when the strict isTauri() is false — no shell means no embedded core and no scheduler to accept the job. The strict check also returns false during the CEF bootstrap gap.

Source

Thrown at app/src/utils/tauriCommands/cron.ts:76

  name?: string;
  schedule: CoreCronSchedule;
  job_type?: 'shell' | 'agent';
  command?: string;
  prompt?: string;
  session_target?: 'isolated' | 'main';
  model?: string;
  agent_id?: string;
  /** Agent profile to attribute this job to (snake_case on the wire). Omit for none. */
  profile_id?: string;
  delivery?: { mode: string; channel?: string | null; to?: string | null; best_effort?: boolean };
  delete_after_run?: boolean;
}

export async function openhumanCronAdd(
  params: CronAddParams
): Promise<CommandResponse<CoreCronJob>> {
  if (!isTauri()) {
    throw new Error('Not running in Tauri');
  }
  return await callCoreRpc<CommandResponse<CoreCronJob>>({ method: 'openhuman.cron_add', params });
}

export async function openhumanCronList(): Promise<CommandResponse<CoreCronJob[]>> {
  if (!isTauri()) {
    throw new Error('Not running in Tauri');
  }
  return await callCoreRpc<CommandResponse<CoreCronJob[]>>({ method: 'openhuman.cron_list' });
}

export async function openhumanCronUpdate(
  jobId: string,
  patch: Record<string, unknown>
): Promise<CommandResponse<CoreCronJob>> {
  if (!isTauri()) {
    throw new Error('Not running in Tauri');
  }

View on GitHub (pinned to a221052e0d)

Solutions

  1. Test cron creation under `pnpm dev:app` so the scheduler persists the job.
  2. Gate the submit handler on isTauri() and disable form submission in browser mode.
  3. Catch the rejection, match 'Not running in Tauri', and keep the draft without pretending it saved.
  4. Mock the cron wrapper module in form tests.

Example fix

// before
const { result: job } = await openhumanCronAdd(params);

// after
if (!isTauri()) {
  toast('Automations run inside the desktop app');
  return;
}
const { result: job } = await openhumanCronAdd(params);
Defensive patterns

Strategy: validation

Validate before calling

if (!isTauri()) {
  toast('Automations run inside the desktop app');
  return;
}
const { result: job } = await openhumanCronAdd(params);

Type guard

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

Try / catch

try {
  return await openhumanCronAdd(params);
} catch (err) {
  if (err instanceof Error && err.message === 'Not running in Tauri') {
    return null; // keep the draft, do not report creation
  }
  throw err;
}

Prevention

When it happens

Trigger: Saving a new automation from /settings/automations (the old /routines, /workflows routes redirect there) while under `pnpm dev`; creating a job in a Vitest test without mocks; the save racing bridge wiring at startup.

Common situations: Building automation-creation UI in browser mode; delivery-mode or profile_id forms tested outside the shell where every submit rejects.

Related errors


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