bug: GET /merges?mode=all returns 500 (KeyError: 'all' in merge_request_table.html)
Maintainers usually reply within 1 day
@iykyk-vedant is already working on this.
Since Nov 29, 2026.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
Research direction
Read openlibrary/templates/merge_request_table/merge_request_table.html and the /merges GET handler in openlibrary/plugins/upstream/edits.py; the issue identifies the failing total[mode] lookup and the total_found counts. Check the CommunityEditsQueue.MODES values in openlibrary/core/edits.py, then reproduce /merges?mode=all as a librarian. Done when that request renders successfully and the existing open and closed modes still work.
Written by the indexing model from the issue text.
Description
Problem
GET /merges?mode=all returns HTTP 500 with KeyError: 'all'.
all is an accepted value: the /merges GET handler validates mode against CommunityEditsQueue.MODES, which includes all (openlibrary/core/edits.py), so the request passes validation and reaches the template.
Root cause
openlibrary/templates/merge_request_table/merge_request_table.html computes pagination as:
$:macros.OlPagination(page, ceil(total[mode] / 25))
but total (built by the GET handler as total_found, openlibrary/plugins/upstream/edits.py) only ever has open and closed keys — never all. When mode == "all", total["all"] raises KeyError: 'all'. The docstring on the template confirms the contract: total : dict : {"open": int, "closed": int}.
Reproduce
- Log in as a librarian.
- Visit
/merges?mode=all. - → 500 (
KeyError: 'all'atmerge_request_table.html,total[mode]).
/merges (default mode=open) and /merges?mode=closed both work.
Suggested fix (not in scope of the PR that found this)
Either derive an all total (e.g. open + closed, or a dedicated count) in the GET handler's total_found, or have the template fall back when mode isn't a key (e.g. total.get(mode, total['open'] + total['closed'])).
Found during live e2e testing of #14774 / PR #14777 (edition merge queue). Pre-existing on master, unrelated to that PR's diff — filed separately so it isn't fixed there.
- Dominant language
- Python
- Stars
- 7k
- Forks
- 2.1k
- Avg merge
- 22h 25m
- Merged PRs (30d)
- 384
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from internetarchive/openlibrary
-
Speed up cover-archival re-runs: skip already-finished batches with a start_idPossibly taken @openlibrary-bot claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
internetarchive/openlibrary#14894 ·
Maintainers usually reply within 1 day
-
Affects: Data Module: Import Needs: Lead Needs: Triage Theme: Identifiers
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
internetarchive/openlibrary#14882 · 3 comments ·
Maintainers usually reply within 1 day
-
Bulk Search progress cards have uneven heightsPossibly taken @shloksangwan claimed this 8 days ago. OpenAffects: UI Lead: @lokesh Module: Bulk Search Module: CSS Priority: 4
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
internetarchive/openlibrary#14669 · 3 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
Affects: Server Lead: @RayBB Needs: Staff Decision Priority: 3 Type: Refactor/Clean-up
Difficulty 1/5 Under an hour Newbie friendliness 78/100
internetarchive/openlibrary#14570 · 2 comments ·
Maintainers usually reply within 1 day
-
Code review stays red after a re-review when the status is already setMay be free again @bettercallok claimed this 10 days ago, and no pull request is open. OpenLead: @mekarpeles Needs: Response Priority: 3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
internetarchive/openlibrary#14486 · 1 comment ·
Maintainers usually reply within 1 day
All issues in internetarchive/openlibrary
Similar issues
-
[Bug]: streaming_end_of_stream_only guardrails rescan the whole stream on every chunk - blocks event loopPossibly taken A pull request linked to this issue is open or already merged. Openbug llm translation
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
arith ascend bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
tile-ai/tilelang#5173 · 2 comments · 1 reaction ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
lanl/text-fetch#92 ·
Maintainers usually reply within 1 day
-
kind: for-triage
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
monumental-archive/.github#2284 ·
Maintainers usually reply within 1 day
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 87/100
TanbirRamim/open-source-radar#761 ·
Maintainers usually reply within 1 day