{"record":{"id":"dd93a0f0f485907e","repo":"tinyhumansai/openhuman","slug":"not-running-in-tauri-dd93a0","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/core.ts","lineNumber":319,"sourceCode":"  if (res && typeof res === 'object' && 'result' in res) return res.result;\n  return false;\n}\n\n/** Write onboarding_completed to core config. */\nexport async function setOnboardingCompleted(value: boolean): Promise<boolean> {\n  if (!isTauri()) return false;\n  const res = await callCoreRpc<boolean | { result: boolean }>({\n    method: 'openhuman.config_set_onboarding_completed',\n    params: { value },\n  });\n  if (typeof res === 'boolean') return res;\n  if (res && typeof res === 'object' && 'result' in res) return res.result;\n  return false;\n}\n\nexport async function openhumanDoctorReport(): Promise<CommandResponse<DoctorReport>> {\n  if (!isTauri()) {\n    throw new Error('Not running in Tauri');\n  }\n  return await callCoreRpc<CommandResponse<DoctorReport>>({ method: 'openhuman.doctor_report' });\n}\n\nexport async function openhumanDoctorModels(\n  useCache = true\n): Promise<CommandResponse<ModelProbeReport>> {\n  if (!isTauri()) {\n    throw new Error('Not running in Tauri');\n  }\n  return await callCoreRpc<CommandResponse<ModelProbeReport>>({\n    method: 'openhuman.doctor_models',\n    params: { use_cache: useCache },\n  });\n}\n\nexport async function openhumanMigrateOpenclaw(\n  sourceWorkspace?: string,","sourceCodeStart":301,"sourceCodeEnd":337,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/a221052e0df5b1f7598fceba7329fd1af95d6699/app/src/utils/tauriCommands/core.ts#L301-L337","documentation":"openhumanDoctorReport requests the platform doctor diagnostic report via the openhuman.doctor_report core RPC, forwarded through the Tauri command bridge (relay_http_rpc). The guard throws when the strict isTauri() returns false — i.e., no Tauri shell (plain browser, SSR, test) or the CEF bootstrap gap where __TAURI_INTERNALS__.invoke is not yet wired. The doctor surface inherently needs the embedded Rust core, so there is no browser fallback.","triggerScenarios":"Opening the doctor/diagnostics screen on mount under `pnpm dev`; a health widget polling doctor_report in browser mode; Vitest rendering the doctor screen without mocks; the fetch racing IPC wiring at app startup.","commonSituations":"Browser-mode UI development of the diagnostics screen; on-mount effects that assume the desktop shell; Sentry noise from unhandled rejections when the screen is viewed outside the shell.","solutions":["Run `pnpm dev:app` when testing doctor flows — the diagnostics only exist with the embedded core.","Gate the screen/effect on isTauri() and show 'diagnostics unavailable outside the desktop app'.","try/catch the call and match the guard message to degrade instead of crashing the screen.","Defer on-mount diagnostics until the bridge is wired (window.__TAURI_INTERNALS__.invoke present)."],"exampleFix":"// before\nuseEffect(() => { void openhumanDoctorReport(); }, []);\n\n// after\nuseEffect(() => {\n  if (!isTauri()) return;\n  void openhumanDoctorReport().catch(() => {/* show unavailable state */});\n}, []);","handlingStrategy":"validation","validationCode":"if (!isTauri()) {\n  setReportUnavailable('Diagnostics require the desktop app');\n  return;\n}\nconst { result } = await openhumanDoctorReport();","typeGuard":"function isNotRunningInTauriError(err: unknown): boolean {\n  return err instanceof Error && err.message === 'Not running in Tauri';\n}","tryCatchPattern":"try {\n  return await openhumanDoctorReport();\n} catch (err) {\n  if (err instanceof Error && err.message === 'Not running in Tauri') {\n    return null; // render 'unavailable outside desktop app'\n  }\n  throw err;\n}","preventionTips":["Doctor data is core-only — gate the whole screen on isTauri().","Load diagnostics lazily (on opening the screen), not eagerly at app boot.","Prefer `pnpm dev:app` when developing diagnostics UI."],"tags":["tauri","ipc","environment-guard","doctor","diagnostics"],"backgroundTag":null,"analyzedSha":"a221052e0df5b1f7598fceba7329fd1af95d6699","analyzedAt":"2026-08-16T12:47:06.542Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}