gitbutlerapp/gitbutler · error
The host rejected the request.
Error message
The host rejected the request.
What it means
Thrown at WorkspaceApp.tsx:792 after app.sendMessage delivered an explain/review prompt (a user-role text message describing the commit/branch review request) to the host application and the result carried isError true — the host accepted the call but refused or failed to process the message. Only the boolean flag is available to the app, hence the generic message shown via setDetailError.
Source
Thrown at packages/but-mcp-app/src/WorkspaceApp.tsx:792
await app.updateModelContext(selectionContext(view, selection));
} catch {
// The message below carries the same repository and selection context.
}
}
const identifier = selectionIdentifier(selection);
const subject =
selection.kind === "commit"
? `commit ${identifier}`
: `branch ${identifier} against its configured target`;
const request =
action === "explain"
? `Explain ${subject} in repository ${view.repository.path}. Describe its intent and the important changes.`
: `Review ${subject} in repository ${view.repository.path} for correctness, regressions, and missing tests.`;
const result = await app.sendMessage({
role: "user",
content: [{ type: "text", text: request }],
});
if (result.isError) throw new Error("The host rejected the request.");
} catch (caught) {
setDetailError(
caught instanceof Error ? caught.message : "Could not start the agent request.",
);
} finally {
setPendingAction(null);
}
}
function clearSelection() {
detailRequest.current += 1;
setSelection(null);
setDetail(null);
setDetailError(null);
setDetailLoading(false);
setCopied(null);
setPendingAction(null);
if (canUpdateContext) {View on GitHub (pinned to 2497b8007a)
Solutions
- Verify the host connection is alive, then retry the action
- Check that the host supports handling user prompts and that permission was granted
- Inspect host-side logs for the rejection reason — this side has no detail beyond isError
- If persistently rejected, copy the composed request text shown in the app and run it manually in the host
Example fix
// before
const result = await app.sendMessage({ role: "user", content: [{ type: "text", text: request }] });
if (result.isError) throw new Error("The host rejected the request.");
// after — keep the request copyable so the user can fall back to manual sending
const result = await app.sendMessage({ role: "user", content: [{ type: "text", text: request }] });
if (result.isError) throw new Error("The host rejected the request. Copy it from the detail panel and send it manually."); Defensive patterns
Strategy: validation
Validate before calling
// run before sending the explain/review prompt to the host
if (!app) {
setDetailError("Not connected to the host application.");
return;
}
if (pendingAction !== null) return; // one in-flight agent request at a time Try / catch
try {
const result = await app.sendMessage({
role: "user",
content: [{ type: "text", text: request }],
});
if (result.isError) throw new Error("The host rejected the request.");
} catch (caught) {
setDetailError(caught instanceof Error ? caught.message : "Could not start the agent request.");
// keep the composed prompt visible/copyable as a manual fallback
} Prevention
- Verify the host connection before sending prompts
- Treat isError as a user-facing hint with a retry affordance, not a crash
- Keep the composed request copyable so the user can send it manually
- Check host capabilities/permissions once at connect time, not per request
When it happens
Trigger: Sending the Explain/Review request when the host lacks agent/sampling support, the user denied the host's permission prompt, the session disconnected mid-request, or host-side limits (quota, context window) rejected the message.
Common situations: Host editor/AI client without prompt-handling support; permission dialog dismissed or timed out; flaky connection between the MCP app and the host; long prompts hitting host limits.
Related errors
- The refreshed reviews were missing from the response.
- textFromToolResult(result)
- The updated review was missing from the response.
- textFromToolResult(result)
- The detail result was missing structured data.
AI-assisted analysis of gitbutlerapp/gitbutler@2497b8007a (2026-08-17).
Data as JSON: /api/errors/bd9695d30d9c64a6.
Report an issue: GitHub.