internetarchive / internetarchive/openlibrary

Wrong error message when attempting bad merge (2 or 0 editions == “more than 200 editions”?)

Open
#9,970 0 comments 0 reactions 0 assignees View on GitHub
Lead: @jimchamp Needs: Breakdown Priority: 3 Type: Bug
Dominant language
Python
Stars
6.7k
Forks
2k
Avg merge
2d 19h
Merged PRs (30d)
138

Description

### Problem

Trying to merge a Work containing 2 Editions into another Work containing 2 Editions give an error message that it couldn’t go through with the merge because the merge subject has more than 200 editions.

This is possibly a cache issue where merge subject is actually a redirect (and the 2 Editions in both Works are actually the same 2 Editions), but it’s still being considered a “real” entity in the cache or somewhere else.

![merging work with 2 editions into another work with 2 editions which should result in a work with 4 editions give an error message about the merge subject having over 200 editions](https://github.com/user-attachments/assets/60baef8d-acee-47be-a797-def171c1f7fc)

### Reproducing the bug

1. Go to https://openlibrary.org/works/merge?records=OL15941796W,OL15400921W
2. Click Do Merge button

* Expected behavior: Either the merge goes through, or it fails with a reasonable/useful error message.
* Actual behavior: Merge fails with the message Could not merge: /works/OL15941796W has more than 200 editions. – which is clearly false, given that the total sum of Editions are 4 (actually 2!).

### Context

- Browser (Chrome, Safari, Firefox, etc): Firefox
- OS (Windows, Mac, etc): Linux (Arch Linux, btw)
- Logged in (Y/N): Y
- Environment (prod, dev, local): prod

### Breakdown

#### Requirements Checklist
* [ ]

#### Related files

*

#### Stakeholders

*


#### Instructions for Contributors

- Please [run these commands](https://github.com/internetarchive/openlibrary/wiki/Git-Cheat-Sheet#working-on-your-branch) to ensure your repository is up to date **before** [creating a new branch](https://github.com/internetarchive/openlibrary/wiki/Git-Cheat-Sheet#making-changes-and-creating-a-pull-request) to work on this issue and **each time after** pushing code to Github, because the pre-commit bot may add commits to your PRs upstream.

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure from the merge URL using the two listed work records, then trace the merge handling and the check that reports more than 200 editions. Compare the actual edition counts with the validation or cache state. Done means the merge succeeds for this case or returns a truthful, useful error message.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.