{"record":{"id":"e3cd88caeb6df4f0","repo":"tinyhumansai/openhuman","slug":"not-running-in-tauri-e3cd88","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/subconscious.ts","lineNumber":66,"sourceCode":"  duration_ms: number;\n  response_chars?: number;\n}\n\n/** Status of the event-driven subconscious trigger pipeline. */\nexport interface SubconsciousTriggersStatus {\n  triggers_enabled: boolean;\n  mode: string;\n  max_promotions_per_hour: number;\n  orchestrator_running: boolean;\n  queue_depth: number | null;\n  orchestrator_thread_id: string;\n  user_thread_id: string;\n}\n\n// ── Status & Trigger ─────────────────────────────────────────────────────────\n\nexport async function subconsciousStatus(): Promise<CommandResponse<SubconsciousStatus>> {\n  if (!isTauri()) throw new Error('Not running in Tauri');\n  return await callCoreRpc<CommandResponse<SubconsciousStatus>>({\n    method: 'openhuman.subconscious_status',\n  });\n}\n\n/**\n * Manually trigger a subconscious tick. `kind` selects the world: 'memory'\n * (default) or 'all'. A no-arg call keeps the legacy memory-only behavior.\n */\nexport async function subconsciousTrigger(\n  kind?: SubconsciousKind | 'all'\n): Promise<CommandResponse<TickResult>> {\n  if (!isTauri()) throw new Error('Not running in Tauri');\n  return await callCoreRpc<CommandResponse<TickResult>>({\n    method: 'openhuman.subconscious_trigger',\n    ...(kind ? { params: { kind } } : {}),\n  });\n}","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/app/src/utils/tauriCommands/subconscious.ts#L48-L84","documentation":"Guard thrown by `subconsciousStatus` before it sends `openhuman.subconscious_status`, which returns the SubconsciousStatus block (triggers_enabled, mode, max_promotions_per_hour, orchestrator_running, queue_depth, orchestrator/user thread ids). The file's own comment (subconscious.ts, right below `subconsciousTrigger`) documents that sibling trigger-pipeline functions intentionally do NOT gate on `isTauri()` because `callCoreRpc` resolves any core transport — so this particular gate is stricter than the transport requires; it throws only because the local relay bridge (`window.__TAURI_INTERNALS__.invoke`) is unavailable in this context.","triggerScenarios":"Opening the subconscious settings/diagnostics panel while the UI runs in the Vite browser preview; calling `subconsciousStatus()` in tests with default non-Tauri mocks; querying during the CEF bootstrap gap; calling it from a webview with an active tunnel/cloud transport where the gate still fires despite `callCoreRpc` being able to dispatch.","commonSituations":"Browser-first development of the subconscious screen; jsdom tests; iOS/remote profiles that talk to a core over LAN/tunnel HTTP and hit the gate even though the underlying RPC would work; polls of orchestrator_running/queue_depth in web mode.","solutions":["Run the UI in the desktop shell (`pnpm dev:app`) for local-core verification.","Skip the status fetch or render placeholders when `!isTauri()` and no remote transport is active.","For parity with the file's transport-aware functions, drop the `isTauri()` gate and let `callCoreRpc` resolve the transport (it already dispatches via `setActiveCoreTransport` profiles).","Mock `isTauri` and `callCoreRpc` in unit tests.","Catch per poll and treat as 'status unavailable' instead of an unhandled rejection."],"exampleFix":"// before (wrapper)\nexport async function subconsciousStatus(): Promise<CommandResponse<SubconsciousStatus>> {\n  if (!isTauri()) throw new Error('Not running in Tauri');\n  return await callCoreRpc<CommandResponse<SubconsciousStatus>>({\n    method: 'openhuman.subconscious_status',\n  });\n}\n\n// after — transport-aware, matching subconsciousTriggersStatus in the same file\nexport async function subconsciousStatus(): Promise<CommandResponse<SubconsciousStatus>> {\n  return await callCoreRpc<CommandResponse<SubconsciousStatus>>({\n    method: 'openhuman.subconscious_status',\n  });\n}","handlingStrategy":"validation","validationCode":"import { isTauri } from '../utils/tauriCommands/common';\n\nif (!isTauri()) {\n  setStatusPlaceholder(); // or check for an active remote transport before giving up\n  return;\n}\nconst st = await subconsciousStatus();","typeGuard":"function isNotInTauriError(e: unknown): e is Error {\n  return e instanceof Error && e.message === 'Not running in Tauri';\n}","tryCatchPattern":"try {\n  const st = await subconsciousStatus();\n} catch (e) {\n  if (e instanceof Error && e.message === 'Not running in Tauri') {\n  setSubconsciousUnavailable(true);\n    return;\n  }\n  throw e;\n}","preventionTips":["Check whether your caller only needs the core (any transport) — the sibling functions in the same file skip the gate for exactly that reason.","Gate the subconscious panel on isTauri() in local-core web previews.","Mock isTauri and callCoreRpc in tests of the panel.","For pollers of orchestrator_running/queue_depth, degrade to placeholders instead of erroring."],"tags":["tauri","environment-guard","frontend","subconscious","status-poll","ipc"],"backgroundTag":"not-running-in-tauri","analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}