Error
- mwversion: 1.44.0-wmf.25
- reqId: 5a043710-8d61-4765-9d0f-c629de0d02f1
- Find reqId in Logstash
[{reqId}] {exception_url} Wikibase\Lexeme\Domain\Model\Exceptions\ConflictException: At least two forms with the same ID were provided: `L855-F1`| Reedy | |
| Apr 21 2025, 3:37 PM |
| F65563716: image.png | |
| Jul 22 2025, 11:00 AM |
| F65535230: image.png | |
| Jul 21 2025, 4:22 PM |
| F61669385: image.png | |
| Jun 5 2025, 4:03 PM |
[{reqId}] {exception_url} Wikibase\Lexeme\Domain\Model\Exceptions\ConflictException: At least two forms with the same ID were provided: `L855-F1`Click link for reprodution: https://test.wikidata.org/w/index.php?action=edit&title=Lexeme:L855&undo=707360&undoafter=707359
Better STR:
From discussion with @Lucas_Werkmeister_WMDE:
'One thing to keep in mind is that (AFAIK) the form/sense counter in a lexeme is preserved across undo/restore. So no matter what you do, it should be impossible to create a new form L123-F1 that’s independent of the original one (any newly created form should be at least -F2 even if you’ve deleted F1 and/or restored revisions in the meantime) and as a consequence, I think in this case it should be sound to conclude that the L123-F1 being restored (undo deletion) is “the same” form as the one that’s already present on the lexeme. In the case you described, that means it would be fine to say “nothing to do here”.
More generally, I assume it’s possible that the form being restored differs from the one already present (e.g. has additional statements), so it might make sense to try to merge it but then again, I’m not sure if that’s actually useful or not. Perhaps it would be better to just always say something like “L123-F1 already exists (again) so its deletion cannot be undone”.'
@Arian_Bozorg: What do you want as behaviour here in the case that we try and restore a form that already exists on the lexeme (with the possibility that the form being restored might contain different statements to the form that exists on the lexeme)?
We can replicate the same message we have for statements when going through the same steps:
The message is:
1 change cannot be undone because the value has changed in the meantime.
There is nothing that can be undone here.
Change #1156281 had a related patch set uploaded (by Arthur taylor; author: Arthur taylor):
[mediawiki/extensions/Wikibase@master] Handle ConflictException when undoing and already-undo diff
Change #1156286 had a related patch set uploaded (by Arthur taylor; author: Arthur taylor):
[mediawiki/extensions/WikibaseLexeme@master] Ensure PatcherException is thrown in the event of patching conflict
Change #1159352 had a related patch set uploaded (by Arthur taylor; author: Arthur taylor):
[mediawiki/extensions/WikibaseLexeme@master] Drop form additions from patches that try to add an existing form
Change #1156286 abandoned by Arthur taylor:
[mediawiki/extensions/WikibaseLexeme@master] Ensure PatcherException is thrown in the event of patching conflict
Reason:
Going with a different approach I68bc73d5
Change #1156281 abandoned by Arthur taylor:
[mediawiki/extensions/Wikibase@master] Handle ConflictException when undoing and already-undo diff
Reason:
Going with a different approach I68bc73d5
Change #1159464 had a related patch set uploaded (by Arthur taylor; author: Arthur taylor):
[mediawiki/extensions/Wikibase@master] Add additional argument to patchEntity to allow soft-fail
Tried a couple of different approaches here. This seems like a tricky problem to solve in an elegant way given the way the interfaces are currently written and given the expectations of existing consumers of the WikibaseLexeme API.
Specifically, wbladdform is expected to throw the ConflictException in the case that a user tries to add the same Form to a Lexeme twice. We don't want to change this behaviour - there may be API clients that query the API to list forms, then try and add missing forms. The ConflictException allows those clients to implement behaviour in a reliable way.
The current patches (1159464-PS2, 1159352-PS6) add an extra argument to patchEntity to allow callers to decide if conflicts should fail with an exception or not (making not throwing the exception the default). But @Lucas_Werkmeister_WMDE has reservations with the current (master) implementation of wbladdform that I will let Lucas explain.
Some things I learned about Wikibase(Lexeme) today:
Change #1162028 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/WikibaseLexeme@master] Use baserevid correctly in wbladdform+wbladdsense
Change #1162028 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] Use baserevid correctly in wbladdform+wbladdsense
Change #1164131 had a related patch set uploaded (by Arthur taylor; author: Arthur taylor):
[mediawiki/extensions/WikibaseLexeme@master] Update buildSaveFlags to implement correct behaviour
Change #1164230 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/WikibaseLexeme@master] WIP: Ignore existing form/sense in LexemePatcher
I think we can use the diff on the next form/sense ID to distinguish between the “undo” case (ignore conflict) and the “add form” case (report conflict, don’t save)?
If we’re undoing the deletion of a form, then the diff includes adding a form, but does not change the next form ID, because deleting the form didn’t change the next form ID either.
If we’re adding a form, then the diff includes both adding a form and incrementing the next form ID.
If those assertions are also true in the opposite direction – form addition without changing next form ID implies undo deletion, and form addition with changing next form ID implies genuine addition – then LexemePatcher can use this to decide what to do about conflicting forms, without needing any more information elsewhere.
Updated the change with that idea. It seems to make both the “undo” test and the “add form” test green, at least.
Change #1164230 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] Skip restoring already-restored form/sense
on beta I was unable to delete the form
https://www.wikidata.beta.wmcloud.org/wiki/Lexeme:L57549
ArthurTaylor added a comment.Edited · Jun 3 2025, 13:44
Comment Actions
STR:
I just clicked the delete button and it disappeared. Could have been a race condition if you made the addition immediately before the deletion?
Change #1159352 abandoned by Arthur taylor:
[mediawiki/extensions/WikibaseLexeme@master] Drop form additions from patches that try to add an existing form
Reason:
See preferred approach I65f26a50fc7a136a2376bb94d08e5942872c4173
Change #1164131 abandoned by Arthur taylor:
[mediawiki/extensions/WikibaseLexeme@master] Update buildSaveFlags to implement correct behaviour
Reason:
See preferred approach I65f26a50fc7a136a2376bb94d08e5942872c4173
Change #1159464 abandoned by Arthur taylor:
[mediawiki/extensions/Wikibase@master] Add additional argument to patchEntity to allow soft-fail
Reason:
See preferred approach I65f26a50fc7a136a2376bb94d08e5942872c4173
According to Logstash, this error hasn’t happened again since 30 June 2025 (1.45.0-wmf.7):