tinyhumansai/openhuman · error · Error
Not running in Tauri
Error message
Not running in Tauri
What it means
This throw comes from `assertTauri()`, the precondition helper in workspacePaths.ts, hit by `openWorkspacePath` (invokes `open_workspace_path`) and `revealWorkspacePath` (invokes `reveal_workspace_path`). These are pure Tauri shell commands that open or reveal a file/folder with the OS file manager — there is no core-RPC path and no web equivalent, so the guard exists because the operation is meaningless outside the desktop shell. `isTauri()` false covers plain browsers, jsdom, and the CEF bootstrap gap where `__TAURI_INTERNALS__.invoke` is not yet wired.
Source
Thrown at app/src/utils/tauriCommands/workspacePaths.ts:23
interface RawWorkspaceTextPreview {
path: string;
absolute_path: string;
contents: string;
truncated: boolean;
size_bytes: number;
}
export interface WorkspaceTextPreview {
path: string;
absolutePath: string;
contents: string;
truncated: boolean;
sizeBytes: number;
}
function assertTauri() {
if (!isTauri()) {
throw new Error('Not running in Tauri');
}
}
export async function openWorkspacePath(path: string): Promise<void> {
assertTauri();
await invoke<void>('open_workspace_path', { path });
}
export async function revealWorkspacePath(path: string): Promise<void> {
assertTauri();
await invoke<void>('reveal_workspace_path', { path });
}
export async function previewWorkspaceText(path: string): Promise<WorkspaceTextPreview> {
assertTauri();
const preview = await invoke<RawWorkspaceTextPreview>('preview_workspace_text', { path });
return {
path: preview.path,View on GitHub (pinned to 7491200858)
Solutions
- Use open/reveal from inside the desktop app, where the shell can talk to the OS file manager.
- Hide open/reveal buttons when `!isTauri()`, or replace them with a copy-path action that works in browsers.
- Mock `isTauri` true and stub `invoke` in unit tests of these affordances.
- Catch the throw at the click handler and show 'opening files requires the desktop app'.
- Verify in the real shell that the path is inside the workspace if the shell-side command also validates scope — this error, though, is purely the environment precondition.
Example fix
// before
<button onClick={() => openWorkspacePath(file.path)}>Open</button>
// after
{isTauri() ? (
<button onClick={() => openWorkspacePath(file.path)}>Open</button>
) : (
<CopyButton value={file.absolutePath} />
)} Defensive patterns
Strategy: validation
Validate before calling
import { isTauri } from '../utils/tauriCommands/common';
const canOpenLocally = isTauri();
if (canOpenLocally) {
await openWorkspacePath(path);
} else {
await navigator.clipboard.writeText(absolutePath); // web fallback
} Type guard
function isNotInTauriError(e: unknown): e is Error {
return e instanceof Error && e.message === 'Not running in Tauri';
} Try / catch
try {
await revealWorkspacePath(path);
} catch (e) {
if (e instanceof Error && e.message === 'Not running in Tauri') {
notify('Opening files requires the desktop app');
return;
}
throw e; // in-shell failures (e.g. path outside workspace) surface here
} Prevention
- Render open/reveal affordances only when isTauri() is true; offer copy-path in browsers.
- These are shell commands with no core-RPC fallback — never assume a web equivalent exists.
- Mock isTauri and invoke in tests of artifact/file viewers.
- Defer reveal actions until after boot-check to avoid the CEF bootstrap gap.
When it happens
Trigger: Clicking an artifact/file 'open' or 'show in folder' affordance while the UI runs in a browser tab (`pnpm dev` in Chrome); a test calling `openWorkspacePath(path)` without mocking `isTauri`; a user clicking reveal during the early bootstrap window before the bridge exists.
Common situations: Browser-mode development of artifact viewers, memory file browsers, or settings pages that offer open/reveal actions; jsdom tests of those components; web previews where the buttons are still visible.
Related errors
- Not running in Tauri
- Not running in Tauri
- Not running in Tauri
- Not running in Tauri
- Not running in Tauri
AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17).
Data as JSON: /api/errors/9c3bd5f8deecc44d.
Report an issue: GitHub.