stablyai/orca · error

Unable to load files

Error message

Unable to load files

What it means

Thrown by MobileFileExplorerPanel.loadDirectory when files.readDir failed with a method-unavailable error on a root load, the legacy files.list fallback was attempted, and the legacy call ALSO failed (legacy.ok === false) with no usable error message. This is the legacy-fallback exhaustion path — neither the modern nor the legacy directory-listing RPC worked.

Solutions

  1. Verify the host connection is still 'connected' (connState) and the worktreeId still exists via worktree.show before retrying loadDirectory.
  2. Use forceReconnect to re-establish the host client, then trigger a root reload.
  3. Check the desktop host logs — both RPCs failing usually indicates a host-side worktree or filesystem problem rather than a client issue.
  4. Surface the underlying error code to the user instead of the generic tail so support can diagnose.

Example fix

// before
throw new Error(
  legacy.error?.message || response.error?.message || 'Unable to load files'
)

// after — keep the codes for diagnostics
const code = legacy.error?.code ?? response.error?.code
throw new Error(
  legacy.error?.message || response.error?.message || `Unable to load files${code ? ` (${code})` : ''}`
)
Defensive patterns

Strategy: fallback

Validate before calling

// Confirm the host is connected and the worktree exists before reload
if (!client || connState !== 'connected') return
const exists = await client.sendRequest('worktree.show', { worktree: `id:${worktreeId}` })
if (!exists.ok || !(exists as any).result?.worktree) return

Type guard

function isFileListUnavailableError(err: unknown): boolean {
  return err instanceof Error && err.message === 'Unable to load files'
}

Try / catch

try {
  await loadDirectory('')
} catch (err) {
  if (isFileListUnavailableError(err)) {
    setError('Could not load files. Reconnecting...')
    await forceReconnect()
    await loadDirectory('')
    return
  }
  throw err
}

Prevention

When it happens

Trigger: At root relativePath, client.sendRequest('files.readDir', ...) returns method_not_found / 'not available to mobile clients', then client.sendRequest('files.list', ...) also returns {ok:false}. Reached only when isMobileMethodUnavailableError matched on the first error AND rootLoad is true.

Common situations: The paired desktop is in a degraded state where both RPC methods reject (e.g., worktree unmounted, host mid-shutdown); the host build is so old that files.list also has a problem; the worktreeId is invalid and both RPCs refuse it.

Related errors


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

Appendix: source

Thrown at mobile/src/files/MobileFileExplorerPanel.tsx:142

            })
            if (legacy.ok) {
              if (
                !isCurrentDirectoryLoad(
                  directoryLoadRevisionsRef.current,
                  scopeRef.current,
                  loadToken
                )
              ) {
                return
              }
              const legacyResult = (legacy as RpcSuccess).result as LegacyFilesListResult
              setDirectoryCache(directoryCacheFromFileList(legacyResult.files))
              // Why: the capped list silently omits files past the cap — keep
              // the legacy explorer's "Showing first 5000" note.
              setLegacyListTruncated(legacyResult.truncated)
              return
            }
            throw new Error(
              legacy.error?.message || response.error?.message || 'Unable to load files'
            )
          }
          throw new Error(response.error?.message || 'Unable to load files')
        }
        if (
          !isCurrentDirectoryLoad(directoryLoadRevisionsRef.current, scopeRef.current, loadToken)
        ) {
          return
        }
        const entries = (response as RpcSuccess).result as MobileDirEntry[]
        if (rootLoad) {
          setLegacyListTruncated(false)
        }
        setDirectoryCache((prev) => ({
          ...prev,
          [relativePath]: { entries }
        }))

View on GitHub (pinned to 1136503c6a)