{"record":{"id":"bd9695d30d9c64a6","repo":"gitbutlerapp/gitbutler","slug":"the-host-rejected-the-request","errorCode":null,"errorMessage":"The host rejected the request.","messagePattern":"The host rejected the request\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/but-mcp-app/src/WorkspaceApp.tsx","lineNumber":792,"sourceCode":"\t\t\t\t\tawait app.updateModelContext(selectionContext(view, selection));\n\t\t\t\t} catch {\n\t\t\t\t\t// The message below carries the same repository and selection context.\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst identifier = selectionIdentifier(selection);\n\t\t\tconst subject =\n\t\t\t\tselection.kind === \"commit\"\n\t\t\t\t\t? `commit ${identifier}`\n\t\t\t\t\t: `branch ${identifier} against its configured target`;\n\t\t\tconst request =\n\t\t\t\taction === \"explain\"\n\t\t\t\t\t? `Explain ${subject} in repository ${view.repository.path}. Describe its intent and the important changes.`\n\t\t\t\t\t: `Review ${subject} in repository ${view.repository.path} for correctness, regressions, and missing tests.`;\n\t\t\tconst result = await app.sendMessage({\n\t\t\t\trole: \"user\",\n\t\t\t\tcontent: [{ type: \"text\", text: request }],\n\t\t\t});\n\t\t\tif (result.isError) throw new Error(\"The host rejected the request.\");\n\t\t} catch (caught) {\n\t\t\tsetDetailError(\n\t\t\t\tcaught instanceof Error ? caught.message : \"Could not start the agent request.\",\n\t\t\t);\n\t\t} finally {\n\t\t\tsetPendingAction(null);\n\t\t}\n\t}\n\n\tfunction clearSelection() {\n\t\tdetailRequest.current += 1;\n\t\tsetSelection(null);\n\t\tsetDetail(null);\n\t\tsetDetailError(null);\n\t\tsetDetailLoading(false);\n\t\tsetCopied(null);\n\t\tsetPendingAction(null);\n\t\tif (canUpdateContext) {","sourceCodeStart":774,"sourceCodeEnd":810,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/2497b8007aa4a1922dae9a805b32ffe5b5037785/packages/but-mcp-app/src/WorkspaceApp.tsx#L774-L810","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nconst result = await app.sendMessage({ role: \"user\", content: [{ type: \"text\", text: request }] });\nif (result.isError) throw new Error(\"The host rejected the request.\");\n\n// after — keep the request copyable so the user can fall back to manual sending\nconst result = await app.sendMessage({ role: \"user\", content: [{ type: \"text\", text: request }] });\nif (result.isError) throw new Error(\"The host rejected the request. Copy it from the detail panel and send it manually.\");","handlingStrategy":"validation","validationCode":"// run before sending the explain/review prompt to the host\nif (!app) {\n\tsetDetailError(\"Not connected to the host application.\");\n\treturn;\n}\nif (pendingAction !== null) return; // one in-flight agent request at a time","typeGuard":null,"tryCatchPattern":"try {\n\tconst result = await app.sendMessage({\n\t\trole: \"user\",\n\t\tcontent: [{ type: \"text\", text: request }],\n\t});\n\tif (result.isError) throw new Error(\"The host rejected the request.\");\n} catch (caught) {\n\tsetDetailError(caught instanceof Error ? caught.message : \"Could not start the agent request.\");\n\t// keep the composed prompt visible/copyable as a manual fallback\n}","preventionTips":["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"],"tags":["mcp","host","agent-request"],"backgroundTag":"mcp-request-rejected","analyzedSha":"2497b8007aa4a1922dae9a805b32ffe5b5037785","analyzedAt":"2026-08-17T00:30:25.648Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}