GitLab: "compare_timeout": true from the compare API
When you compare two branches, tags or commits with GET /projects/:id/repository/compare, GitLab can answer "compare_timeout": true. The GitLab docs say that the comparison then exceeded size limits or timed out, and that the diffs array might be incomplete (Repositories API, checked October 29, 2026). In the GitLab source, the field is the overflow of the diff list: it is true when the comparison has more changed files or lines than the instance shows in one diff, whatever the time it took.
GET /api/v4/projects/:id/repository/compare?from=main&to=feature
{"commit": {...},
"commits": [...],
"diffs": [...],
"compare_timeout": true,
"compare_same_ref": false,
"web_url": "https://gitlab.example.com/group/project/-/compare/main...feature"}
What the field means
The compare entity of the API (lib/api/entities/compare.rb) sets compare_timeout to the overflow? of the diff collection it returns. That collection is built with the diff options of the instance (app/models/commit.rb, max_diff_options): at most diff_max_files files and diff_max_lines changed lines. So the name says timeout, but the usual reason is size: a comparison with more files or lines than these limits answers true every time you ask.
- The commits are complete. GitLab: the
commitsarray is always complete, even whencompare_timeoutis true. - The diffs are not. Files past the limit are left out of
diffs, and a single file can come with an emptydiffstring when its content went over the limits. - Per file, since GitLab 18.4:
collapsedtrue means that the diff of the file was left out but can be fetched on request;too_largetrue means that it was left out and cannot be retrieved.
The limits
From Diff limits (checked October 29, 2026):
- Maximum diff files: the total number of files changed in a diff, 1000 by default, at most 3000.
- Maximum diff lines: the total number of lines changed in a diff, 50,000 by default, at most 100,000.
- Maximum diff patch size: 200 KB by default, at most 500 KB. Diffs over a limit are shown as too large and cannot be expanded in the UI; diffs that reach 10 percent of a limit are collapsed, with a link to expand them.
On GitLab Self-Managed and GitLab Dedicated, an administrator can change them in Admin > Settings > General > Diff limits. On GitLab.com, diff limits cannot be configured.
Why a comparison gets this large
- A direct comparison after a rebase. With
straight=true, GitLab comparesfromandtodirectly. If the branch was rebased onto a target that moved, the old head and the new head differ by everything the target gained in between, not only by the new commits of the branch. - A comparison from an old base. Without
straight(the default is false), GitLab compares from the merge base. Between a long-lived branch and the default branch, that can still be thousands of files. - Generated or vendored files: lock files, build output or copied libraries add many files and lines to every comparison that touches them.
What to do
- Read the commits, then compare in smaller steps: the
commitsarray is complete, so you can compare shorter ranges, or read the diff of each commit withGET /projects/:id/repository/commits/:sha/diff. - Compare locally when you need the whole list:
git diff --stat from..tohas no such limit. - Choose the comparison: after a rebase, compare from the merge base (leave out
straight) to see only what the branch changes. - On your own instance: an administrator can raise Maximum diff files and Maximum diff lines, up to 3000 files and 100,000 lines.
GitLab merge requests in IntelliJ IDEA
Lesstep makes Merge Request Inbox for GitLab for JetBrains IDEs 2024.1 or later. It marks the files that changed since you last opened a merge request: it compares the head you saw with the new head, directly. When GitLab answers compare_timeout true, the plugin cannot tell which files the push touched, so it shows no changed marks for that push and clears the viewed marks of that merge request, so that no file stays marked as viewed when it may have changed. Reading is free; approving, commenting and merging are Pro (US$1.50 a month, with a 30-day trial).
GITLAB is a trademark of GitLab Inc.; IntelliJ IDEA is a trademark of JetBrains s.r.o. This page is not affiliated with or endorsed by GitLab Inc. or JetBrains.
More: GitLab merge request changes cut short ("1000+", too_large) · GitLab 429 "Retry later" (rate limits) · GitLab merge refused (405, 409, 422) · GitLab merge request list refused (400, 404) · GitLab 404 "Project Not Found" · GitLab merge request plugins for IntelliJ IDEA, compared · 日本語