stablyai/orca · error · Error

Unable to load agent sessions

Error message

Unable to load agent sessions

What it means

Thrown by the mobile agent-history hook after it has confirmed capabilities and computed scopePaths, when the actual `aiVault.listSessions` RPC returns ok=false. It is the data-fetch failure for the session list itself; the generic string is used only when the host's error.message is empty.

Source

Thrown at mobile/src/agent-history/use-mobile-agent-history-state.ts:126

        // proceed even if the worktree isn't found, to avoid a stuck spinner.
        if (options.scope !== 'all' && !activeWorktree && !worktreesLoaded) {
          if (isCurrent()) {
            setScreenState((prev) => (prev.kind === 'ready' ? prev : { kind: 'loading' }))
          }
          return
        }

        const scopePaths = deriveMobileAiVaultScopePaths(options.scope, activeWorktree, worktrees)
        const response = await client.sendRequest('aiVault.listSessions', {
          limit: MOBILE_AI_VAULT_SESSION_LIMIT,
          force: options.force,
          scopePaths
        })
        if (!isCurrent()) {
          return
        }
        if (!response.ok) {
          throw new Error(response.error?.message || 'Unable to load agent sessions')
        }
        const result = (response as RpcSuccess).result as AiVaultListResult
        setScreenState({ kind: 'ready', sessions: result.sessions, issues: result.issues })
      } catch (err) {
        if (!isCurrent()) {
          return
        }
        const message = err instanceof Error ? err.message : 'Unable to load agent sessions'
        setHostStatusResult(null)
        setScreenState({ kind: 'error', message })
      }
    },
    [activeWorktree, client, connState, worktrees, worktreesLoaded]
  )

  // Initial + reconnect load. Why: scope switches reuse the host's 15s cache
  // (force:false) so a tab tap is cheap; only an explicit refresh bypasses it.
  useEffect(() => {

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Check the host logs for the aiVault.listSessions handler's error.
  2. Confirm the scopePaths/worktree still exists on the host (worktree was not deleted).
  3. Retry with options.force=true to bypass a stale cache that may have poisoned state.
  4. Ensure the vault directory permissions allow the host process to read.

Example fix

// before
if (!response.ok) {
  throw new Error(response.error?.message || 'Unable to load agent sessions')
}

// after — surface the host error code for actionable retries
if (!response.ok) {
  const code = (response as RpcFailure).error.code
  if (code === 'scopeNotFound') { setScreenState({ kind: 'empty' }); return }
  throw new Error((response as RpcFailure).error.message || 'Unable to load agent sessions')
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Ensure scopePaths are non-empty before the fetch
const scopePaths = deriveMobileAiVaultScopePaths(options.scope, activeWorktree, worktrees)
if (options.scope !== 'all' && scopePaths.length === 0) {
  setScreenState({ kind: 'empty' }); return
}

Type guard

function isListSessionsSuccess(r: RpcSuccess | RpcFailure): r is RpcSuccess & { result: AiVaultListResult } {
  return r.ok
}

Try / catch

try {
  const response = await client.sendRequest('aiVault.listSessions', { limit, force, scopePaths })
  if (!isCurrent()) return
  if (!response.ok) throw new Error(response.error?.message || 'Unable to load agent sessions')
} catch (err) {
  if (!isCurrent()) return
  setScreenState({ kind: 'error', message: (err as Error).message })
}

Prevention

When it happens

Trigger: aiVault.listSessions returns a failure (host-side filesystem error reading the vault directory, permission denied, scopePaths resolve to a missing path, or a timeout). The catch wraps it and sets screen state to 'error'.

Common situations: The AI vault directory is missing or unreadable on the host, scopePaths point at a worktree that no longer exists, the host's vault indexing hit an exception, or the request exceeded its timeout under heavy load.

Related errors


AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12). Data as JSON: /api/errors/2b2969f9db8c99c1. Report an issue: GitHub.