{"record":{"id":"f486238da9160803","repo":"stablyai/orca","slug":"unable-to-open-diff","errorCode":null,"errorMessage":"Unable to open diff","messagePattern":"Unable to open diff","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"mobile/src/source-control/use-mobile-source-control-openers.ts","lineNumber":128,"sourceCode":"        // Snapshot the active tab now, at tap time, before the openDiff RPC —\n        // the session uses it to avoid stealing focus if the user switches tabs\n        // during the RPC window.\n        onFileOpenStart?.()\n        let response = await client.sendRequest('files.openDiff', {\n          worktree: `id:${worktreeId}`,\n          relativePath: entry.path,\n          staged: entry.area === 'staged'\n        })\n        let openedTabMode: 'diff' | 'edit' = 'diff'\n        if (!response.ok && isMobileGitUnavailable(response.error?.code, response.error?.message)) {\n          response = await client.sendRequest('files.open', {\n            worktree: `id:${worktreeId}`,\n            relativePath: entry.path\n          })\n          openedTabMode = 'edit'\n        }\n        if (!response.ok) {\n          throw new Error(response.error?.message || 'Unable to open diff')\n        }\n        if (!mountedRef.current) {\n          return\n        }\n        const revealResult = await revealMobileSourceControlSessionDiff({\n          client,\n          worktreeId,\n          relativePath: entry.path,\n          tabMode: openedTabMode,\n          staged: entry.area === 'staged',\n          onOpenedFileDiff,\n          isCurrent: () => mountedRef.current && openingPathRef.current === entry.path\n        })\n        if (revealResult === 'cancelled') {\n          return\n        }\n        if (revealResult === 'timeout') {\n          throw new Error(\"The file opened, but its tab isn't ready yet. Try again.\")","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/mobile/src/source-control/use-mobile-source-control-openers.ts#L110-L146","documentation":"Thrown by `openFile` when neither `files.openDiff` nor its `files.open` fallback produces an ok response. The fallback to `files.open` only runs when `files.openDiff` failed with a mobile-git-unavailable code (old host without diff support); for any other openDiff failure, or when the fallback itself fails, this error is thrown and shown via `setActionError`.","triggerScenarios":"Tapping a changed file to open its diff where `files.openDiff` fails with a non-git-unavailable error, OR the host is git-unavailable and the `files.open` fallback also fails — e.g. the file no longer exists on disk, permission denied, or the worktree path is invalid.","commonSituations":"File was deleted/moved between status load and tap; permission error reading the file on an SSH host; old desktop build where both openDiff is unsupported and open fails for another reason; large file the host refuses to open.","solutions":["Refresh source-control status and retry — the entry may have stale path info.","Confirm the file exists and is readable on the host.","Update the desktop host so `files.openDiff` is supported (removing the need for the fallback).","Open the file directly in an external editor as a workaround."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// openFile already wraps this in try/catch and calls setActionError;\n// callers should offer a Retry and refresh status before re-tapping.\ntry {\n  await openFile(entry)\n} catch {\n  await loadStatus({ force: true }) // refresh path info\n}","preventionTips":["Refresh status before opening a file whose path may be stale.","Update the host to support files.openDiff so the files.open fallback isn't needed.","Confirm file readability on SSH hosts where permissions differ."],"tags":["rpc","source-control","diff","files"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}