github/github-mcp-server · error
failed to read response body: %w
Error message
failed to read response body: %w
What it means
Error "failed to read response body: %w" thrown in github/github-mcp-server.
Source
Thrown at pkg/github/pullrequests.go:183
if err != nil {
return nil, fmt.Errorf("failed to get repo access cache: %w", err)
}
ff := deps.GetFlags(ctx)
pr, resp, err := client.PullRequests.Get(ctx, owner, repo, pullNumber)
if err != nil {
return ghErrors.NewGitHubAPIErrorResponse(ctx,
"failed to get pull request",
resp,
err,
), nil
}
defer func() { _ = resp.Body.Close() }()
if resp.StatusCode != http.StatusOK {
body, err := io.ReadAll(resp.Body)
if err != nil {
return nil, fmt.Errorf("failed to read response body: %w", err)
}
return ghErrors.NewGitHubAPIStatusErrorResponse(ctx, "failed to get pull request", resp, body), nil
}
// sanitize title/body on response
if pr != nil {
if pr.Title != nil {
pr.Title = github.Ptr(sanitize.Sanitize(*pr.Title))
}
if pr.Body != nil {
pr.Body = github.Ptr(sanitize.Sanitize(*pr.Body))
}
}
if ff.LockdownMode {
if restricted, err := authorLockdownResult(ctx, cache, owner, repo, pr.GetUser().GetLogin(), lockdownPullRequestRestrictedMessage); restricted != nil || err != nil {
return restricted, err
}View on GitHub (pinned to 0ea1f775a7)
When it happens
Trigger: Thrown at pkg/github/pullrequests.go:183 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of github/github-mcp-server@0ea1f775a7 (2026-08-15).
Data as JSON: /api/errors/5b97bec2c91c3cc5.
Report an issue: GitHub.