{"record":{"id":"fc9e64d707e64cc7","repo":"gitbutlerapp/gitbutler","slug":"textfromtoolresult-result","errorCode":null,"errorMessage":"textFromToolResult(result)","messagePattern":"textFromToolResult\\(result\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"packages/but-mcp-app/src/ReviewApp.tsx","lineNumber":346,"sourceCode":"\t\t\treturn;\n\t\t}\n\n\t\tconst reviewNumbers = view.reviews.filter(shouldPollReview).map((review) => review.number);\n\t\tif (reviewNumbers.length === 0) return;\n\n\t\tlet cancelled = false;\n\n\t\tasync function refreshReviews() {\n\t\t\ttry {\n\t\t\t\tconst result = await app?.callServerTool({\n\t\t\t\t\tname: \"gitbutler_refresh_reviews\",\n\t\t\t\t\targuments: {\n\t\t\t\t\t\trepository: view?.repository.path,\n\t\t\t\t\t\treviewNumbers,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t\tif (cancelled || result === undefined) return;\n\t\t\t\tif (result.isError) throw new Error(textFromToolResult(result));\n\t\t\t\tconst refreshed = reviewViewFromToolResult(result);\n\t\t\t\tif (refreshed === null) {\n\t\t\t\t\tthrow new Error(\"The refreshed reviews were missing from the response.\");\n\t\t\t\t}\n\t\t\t\tsetView((current) => (current === null ? current : mergeReviewViews(current, refreshed)));\n\t\t\t} catch (pollCause) {\n\t\t\t\tif (cancelled) return;\n\t\t\t\tsetPollingError(\n\t\t\t\t\tpollCause instanceof Error ? pollCause.message : \"Could not refresh CI status.\",\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tconst timeout = window.setTimeout(() => void refreshReviews(), REVIEW_POLL_INTERVAL_MS);\n\t\treturn () => {\n\t\t\tcancelled = true;\n\t\t\twindow.clearTimeout(timeout);\n\t\t};","sourceCodeStart":328,"sourceCodeEnd":364,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/packages/but-mcp-app/src/ReviewApp.tsx#L328-L364","documentation":"The MCP tool call gitbutler_refresh_reviews returned a result with isError=true, and the thrown message is textFromToolResult(result) — the error text the tool/server produced. The logged 'message' is the helper expression itself; the user actually sees the server's diagnostic string.","triggerScenarios":"Calling gitbutler_refresh_reviews with a repository path the server cannot open, reviewNumbers that no longer exist, or a backend git failure while recomputing CI/review state; the periodic poll in ReviewApp hits it every REVIEW_POLL_INTERVAL_MS until it clears.","commonSituations":"The repository was moved/deleted after the view loaded; reviews were closed remotely so the numbers are stale; the MCP server's git invocation fails (auth, lock, corruption).","solutions":["Confirm view?.repository.path still exists on the machine running the MCP server.","Reload/reopen the reviews view so fresh review numbers are passed instead of stale ones.","Read the full tool-result text (setPollingError shows it) — it carries the server's underlying git error.","Restart the MCP host if the server-side git state is wedged (stale locks, dead credential helper)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (!view?.repository.path) {\n  setPollingError(\"Repository path is unknown — reload the view.\");\n  return;\n}","typeGuard":null,"tryCatchPattern":"try {\n  const result = await app?.callServerTool({ name: \"gitbutler_refresh_reviews\", arguments: { repository: view?.repository.path, reviewNumbers } });\n  if (result?.isError) throw new Error(textFromToolResult(result));\n} catch (pollCause) {\n  if (cancelled) return;\n  setPollingError(pollCause instanceof Error ? pollCause.message : \"Could not refresh CI status.\");\n}","preventionTips":["Validate the repository path exists before scheduling the poll.","Stop the poll loop after consecutive failures instead of hammering a broken repo path.","Surf the full tool-result text — it contains the server's git error."],"tags":["mcp","gitbutler","tool-error","polling","react"],"backgroundTag":"mcp-tool-error","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}