{"record":{"id":"7102e1d4fed4e42e","repo":"stablyai/orca","slug":"unable-to-load-source-control","errorCode":null,"errorMessage":"Unable to load source control","messagePattern":"Unable to load source control","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"mobile/src/source-control/use-mobile-source-control-loaders.ts","lineNumber":233,"sourceCode":"            }\n            if (isMobileGitUnavailable(response.error?.code, response.error?.message)) {\n              setScreenState({\n                kind: 'unavailable',\n                message: 'Update Orca desktop to use Source Control on mobile.'\n              })\n              return false\n            }\n            const shouldRetry =\n              response.error?.code === 'selector_not_found' ||\n              isMobileGitTransientRefreshError(response.error?.code, response.error?.message)\n            if (shouldRetry && attempt < SELECTOR_RETRY_COUNT) {\n              await wait(SELECTOR_RETRY_DELAY_MS)\n              if (!isCurrentLoad()) {\n                return false\n              }\n              continue\n            }\n            throw new Error(response.error?.message || 'Unable to load source control')\n          }\n        } catch (err) {\n          if (!isCurrentLoad()) {\n            return false\n          }\n          const message = err instanceof Error ? err.message : 'Unable to load source control'\n          setScreenState((prev) => {\n            // Why: git mutations can succeed while the immediate status refresh\n            // races a desktop abort; keep the last good screen instead of flashing\n            // a full-screen error that Retry fixes a moment later.\n            if (options?.preserveReadyOnFailure && prev.kind === 'ready') {\n              return prev\n            }\n            return { kind: 'error', message }\n          })\n          return false\n        }\n        return false","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/mobile/src/source-control/use-mobile-source-control-loaders.ts#L215-L251","documentation":"Thrown by `loadStatus` when the `git.status` RPC fails after exhausting retries. The retry loop (up to `SELECTOR_RETRY_COUNT`) only retries `selector_not_found` and transient refresh errors (`request_aborted`/`aborting`); git-unavailable codes set an 'unavailable' screen state instead. Any other failure, or a retryable failure that never succeeds, throws this and sets the screen error state (unless `preserveReadyOnFailure` keeps the last good screen).","triggerScenarios":"Opening/refreshing the source-control screen where `git.status` persistently returns ok:false: invalid/stale worktree selector that never resolves, a non-transient git error (corrupt index, permission denied), or `selector_not_found` that persists across all retries.","commonSituations":"The worktree was deleted or moved after the route opened; the host git index is locked or corrupt; SSH host lost its git binary; the selector referenced a worktree that is mid-create and not yet registered.","solutions":["Tap Retry — a new load generation re-fetches status with a fresh selector.","Confirm the worktree still exists on the host and reselect it if not.","On the host, clear a stale `.git/index.lock` or run `git status` to surface the underlying error.","If `selector_not_found` recurs, ensure worktree registration completed before opening source control."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Confirm the worktree selector is valid before relying on status loads.\nconst probe = await client.sendRequest('worktree.show', { worktree: `id:${worktreeId}` })\nif (!probe.ok) { /* expect selector_not_found retries then this error */ }","typeGuard":null,"tryCatchPattern":"// loadStatus already retries selector_not_found / transient errors;\n// on final failure it sets screenState to error — wire a Retry button to loadStatus({ force: true }).\ntry {\n  await loadStatus({ force: true })\n} catch {\n  // screen state is 'error'; user-initiated Retry recovers\n}","preventionTips":["Ensure worktree registration finishes before opening source control (avoids selector_not_found).","Keep preserveReadyOnFailure after git mutations so a racing abort doesn't flash a full-screen error.","Clear stale .git/index.lock on the host if status persistently fails."],"tags":["rpc","source-control","git","retry","status"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}