reviewdog: GitHub Pull Request diff API responds with 406 — diff too large
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: https://github.com/platformsh/platformsh-docs/pull/3885#issuecomment-2018746515
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"
}
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 25
- Comments: 26 (8 by maintainers)
Commits related to this issue
- chore: remove temporary reviewdog fix (#12284) - [x] depends on: https://github.com/reviewdog/action-suggester/pull/52 This reverts #12280 after the upstream fix https://github.com/reviewdog/... — committed to leanprover-community/mathlib4 by mo271 3 years ago
- chore: remove temporary reviewdog fix (#12284) - [x] depends on: https://github.com/reviewdog/action-suggester/pull/52 This reverts #12280 after the upstream fix https://github.com/reviewdog/... — committed to leanprover-community/mathlib4 by mo271 3 years ago
- chore: remove temporary reviewdog fix (#12284) - [x] depends on: https://github.com/reviewdog/action-suggester/pull/52 This reverts #12280 after the upstream fix https://github.com/reviewdog/... — committed to leanprover-community/mathlib4 by mo271 3 years ago
- chore: remove temporary reviewdog fix (#12284) - [x] depends on: https://github.com/reviewdog/action-suggester/pull/52 This reverts #12280 after the upstream fix https://github.com/reviewdog/... — committed to leanprover-community/mathlib4 by mo271 3 years ago
- skip some reviewdog jobs to avoid HTTP 406 https://github.com/reviewdog/reviewdog/issues/1696 — committed to percona/percona-backup-mongodb by defbin 3 years ago
- chore: remove temporary reviewdog fix (#12284) - [x] depends on: https://github.com/reviewdog/action-suggester/pull/52 This reverts #12280 after the upstream fix https://github.com/reviewdog/... — committed to leanprover-community/mathlib4 by mo271 3 years ago
- Update `Vale` CI action to handle large diffs This PR helps us to avoid running into the issue described in https://github.com/reviewdog/reviewdog/issues/1696, where diffs that are too large will cau... — committed to caass/nativelink by caass 2 years ago
- Update `Vale` CI action to handle large diffs This PR helps us to avoid running into the issue described in https://github.com/reviewdog/reviewdog/issues/1696, where diffs that are too large will cau... — committed to caass/nativelink by caass 2 years ago
- Update `Vale` CI action to handle large diffs (#978) This PR helps us to avoid running into the issue described in https://github.com/reviewdog/reviewdog/issues/1696, where diffs that are too large... — committed to TraceMachina/nativelink by caass 2 years ago
- Update doc-validator.yml https://github.com/grafana/technical-documentation/releases/tag/doc-validator%2Fv5.1.0 **What this PR does / why we need it**: Includes the fix for large GitHub diffs r... — committed to grafana/tempo by jdbaldry 2 years ago
Currently, this issue is only resolved when the reporter is
github-pr-review. Therefore, I think thatgithub-check,github-pr-checkandgithub-pr-annotationsalso need to be resolved.It seems possible to work around this using the PR files API in many cases, but it’s not a drop-in replacement. The files JSON response still returns the patch text, but it’s not in the same multi-file format that the other endpoint returns. The docs claim that the files API can return results in the same
application/vnd.github.diffformat as the base PR API, but this doesn’t seem to actually work. SettingAccept: application/vnd.github.diffstill seems to return JSON. I have an inquiry in to GitHub support about whether this is a bug or if the docs are wrong.Is there a reason that we need to be fetching this diff from GitHub instead of just using git to generate it locally from the repo? Is there an existing DiffService that already does this that we could use as fallback?
https://github.com/massongit/action-android-lint-example/actions/runs/12255678175/job/34189298844#step:2:57
https://github.com/massongit/action-android-lint-example/actions/runs/12255678175/job/34189298844#step:7:13
I prepared a PR https://github.com/massongit/action-android-lint-example/pull/1 with over 300 new files and tried running
dvdandroid/action-android-lint@v1.2with the same options. However, the latestreviewdogwas installed and fell back to the git command.Do the related actions need bumping ?
eg. reviewdog/action-shellcheck etc?
While setting
fetch-depth: 0did solve this specific issue, it caused other problems like running out of disk space, taking 10 minutes to clone, etc. It’s also not ideal that every GitHub user will have to update their checkout rather than this fallback working by default.I’m not a git expert, but it seems that if we did a fetch like this, using GitHub default env vars, the necessary branch would be available for the subsequent
git merge-basecommand. Thoughts?https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
Seeing similar issues with PRs with lots of files. We have an automation to sync assets from designers and it had around 1200 files changed. Failed in the same way but with a different message about to many files.