Skip to content

GitHub Pull Request diff API responds with 406 — diff too large #1696

@reidab

Description

@reidab

We've started seeing several of our GitHub actions builds with reviewdog fail this morning because the GitHub API is returning a 406 error code on diffs larger than 3,000 lines. This seems to be new GitHub API behavior because the same version of reviewdog worked was passing on these same PRs three days ago.

The error message currently has no relevant Google results. Searching around on GitHub, I only find one mention of Code:too_large with field: diff anywhere, and it's from another reviewdog user today: platformsh/platformsh-docs#3885 (comment)

We've seen this both when running from actions like https://github.com/reviewdog/action-brakeman and from custom actions that invoke reviewdog manually.

An example reviewdog error when running with reviewdog -name=Hadolint -reporter=github-check -efm='%f:%l %m' -level=warning:

reviewdog: post failed for Hadolint: fail to parse diff: 
GET https://api.github.com/repos/thedyrt/<redacted>/pulls/<redacted>: 
406 Sorry, the diff exceeded the maximum number of lines (3000)
 [{Resource:PullRequest Field:diff Code:too_large Message:}]

The API response from GitHub:

{
  "message": "Sorry, the diff exceeded the maximum number of lines (3000)",
  "errors": [
    {
      "resource": "PullRequest",
      "field": "diff",
      "code": "too_large"
    }
  ],
  "documentation_url": "https://docs.github.com/rest/pulls/pulls#get-a-pull-request"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions