gitbutlerapp/gitbutler · error
textFromToolResult(result)
Error message
textFromToolResult(result)
What it means
Not a fixed message: at ReviewApp.tsx:401 the app throws new Error(textFromToolResult(result)) when the gitbutler_mark_review_ready tool answers with isError true. The actual string is the first text content item in the tool result (or "The review operation failed." when there is none), i.e. the server-side failure explanation, displayed via setActionError next to the review card.
Source
Thrown at packages/but-mcp-app/src/ReviewApp.tsx:401
);
}
const connectedApp = app;
const currentView = view;
const canCallTools = connectedApp.getHostCapabilities()?.serverTools !== undefined;
async function markReady(review: ReviewCardData) {
setPendingReview(review.number);
setActionError(null);
try {
const result = await connectedApp.callServerTool({
name: "gitbutler_mark_review_ready",
arguments: {
repository: currentView.repository.path,
reviewNumber: review.number,
},
});
if (result.isError) throw new Error(textFromToolResult(result));
const updatedView = reviewViewFromToolResult(result);
const updatedReview = updatedView?.reviews[0];
if (!updatedReview) throw new Error("The updated review was missing from the response.");
setView((current) =>
current === null || updatedView === null ? current : mergeReviewViews(current, updatedView),
);
} catch (actionCause) {
setActionError(
actionCause instanceof Error ? actionCause.message : "Could not mark the review ready.",
);
} finally {
setPendingReview(null);
}
}
async function openReview(review: ReviewCardData) {
setActionError(null);
try {View on GitHub (pinned to 2497b8007a)
Solutions
- Read the surfaced text — it is the tool's own failure reason, not a client-side guess
- Refresh the review list and retry with a valid review still in draft state
- Re-authenticate the forge integration if the text mentions authorization
- Verify the repository path matches an open GitButler project
Example fix
// before
if (result.isError) throw new Error(textFromToolResult(result));
// after — keep the review number in the message for easier triage
if (result.isError) throw new Error(`Mark review #${review.number} ready failed: ${textFromToolResult(result)}`); Defensive patterns
Strategy: validation
Validate before calling
// run before invoking gitbutler_mark_review_ready
if (!view?.repository.path) throw new Error("No repository selected.");
if (review.state !== "draft") {
disableMarkReady(review.number); // non-draft reviews cannot be marked ready — avoid the doomed call
} Try / catch
try {
const result = await connectedApp.callServerTool({
name: "gitbutler_mark_review_ready",
arguments: { repository: currentView.repository.path, reviewNumber: review.number },
});
if (result.isError) throw new Error(textFromToolResult(result)); // tool text is the real reason
} catch (actionCause) {
setActionError(actionCause instanceof Error ? actionCause.message : "Could not mark the review ready.");
} Prevention
- Disable the action for reviews not in a markable (draft) state
- Refresh the review list before acting so review numbers are current
- Check result.isError first and display its text verbatim — it is the server's own diagnosis
- Re-check forge authentication when the text mentions authorization
When it happens
Trigger: gitbutler_mark_review_ready with {repository, reviewNumber} fails server-side: review number not found, review not in a markable state (already ready, merged, or closed), forge authentication expired, or a network failure reaching the forge.
Common situations: Stale review list where the review was closed or merged elsewhere; expired GitHub/forge token; review mid state-transition; repository path no longer matching an open project.
Related errors
- The refreshed reviews were missing from the response.
- The updated review was missing from the response.
- textFromToolResult(result)
- The detail result was missing structured data.
- The host rejected the request.
AI-assisted analysis of gitbutlerapp/gitbutler@2497b8007a (2026-08-17).
Data as JSON: /api/errors/fc9e64d707e64cc7.
Report an issue: GitHub.