{"record":{"id":"9c3bd5f8deecc44d","repo":"tinyhumansai/openhuman","slug":"not-running-in-tauri-9c3bd5","errorCode":null,"errorMessage":"Not running in Tauri","messagePattern":"Not running in Tauri","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"app/src/utils/tauriCommands/workspacePaths.ts","lineNumber":23,"sourceCode":"interface RawWorkspaceTextPreview {\n  path: string;\n  absolute_path: string;\n  contents: string;\n  truncated: boolean;\n  size_bytes: number;\n}\n\nexport interface WorkspaceTextPreview {\n  path: string;\n  absolutePath: string;\n  contents: string;\n  truncated: boolean;\n  sizeBytes: number;\n}\n\nfunction assertTauri() {\n  if (!isTauri()) {\n    throw new Error('Not running in Tauri');\n  }\n}\n\nexport async function openWorkspacePath(path: string): Promise<void> {\n  assertTauri();\n  await invoke<void>('open_workspace_path', { path });\n}\n\nexport async function revealWorkspacePath(path: string): Promise<void> {\n  assertTauri();\n  await invoke<void>('reveal_workspace_path', { path });\n}\n\nexport async function previewWorkspaceText(path: string): Promise<WorkspaceTextPreview> {\n  assertTauri();\n  const preview = await invoke<RawWorkspaceTextPreview>('preview_workspace_text', { path });\n  return {\n    path: preview.path,","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/app/src/utils/tauriCommands/workspacePaths.ts#L5-L41","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\n<button onClick={() => openWorkspacePath(file.path)}>Open</button>\n\n// after\n{isTauri() ? (\n  <button onClick={() => openWorkspacePath(file.path)}>Open</button>\n) : (\n  <CopyButton value={file.absolutePath} />\n)}","handlingStrategy":"validation","validationCode":"import { isTauri } from '../utils/tauriCommands/common';\n\nconst canOpenLocally = isTauri();\nif (canOpenLocally) {\n  await openWorkspacePath(path);\n} else {\n  await navigator.clipboard.writeText(absolutePath); // web fallback\n}","typeGuard":"function isNotInTauriError(e: unknown): e is Error {\n  return e instanceof Error && e.message === 'Not running in Tauri';\n}","tryCatchPattern":"try {\n  await revealWorkspacePath(path);\n} catch (e) {\n  if (e instanceof Error && e.message === 'Not running in Tauri') {\n    notify('Opening files requires the desktop app');\n    return;\n  }\n  throw e; // in-shell failures (e.g. path outside workspace) surface here\n}","preventionTips":["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."],"tags":["tauri","environment-guard","frontend","workspace","shell-command","file-system","ipc"],"backgroundTag":"not-running-in-tauri","analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}