"specified index out of bounds" issue when moving a statement
Closed, ResolvedPublic

Description

There are certain scenarios when moving a statement in the UI results in an "specified index is out of bounds" error.

https://www.wikidata.org/wiki/Wikidata:Contact_the_development_team#Exception_Caught:_Specified_index_is_out_of_bounds


Version: master
Severity: major
Whiteboard: backlog

bzimport added a subscriber: wikidata-bugs.
bzimport set Reference to bz58394.
Lydia_Pintscher created this task.Via LegacyDec 12 2013, 3:05 PM
Snaterlicious added a comment.Via ConduitDec 12 2013, 3:27 PM

This occurs, for example, when adding three statements with a property not yet featured by the item.
The UI sends the correct information, although the baseRevId sent along with the request is, of course, the one received when the item was loaded since that one is not updated by the "add statement" operation.
When the entity content is loaded in the SetClaim module, the initial set of claims/statements as to the baseRevId is loaded and passed to ChangeOpClaim. Consequently, the statements just added are missing and the index where to place the statements within the flat list of statements is wrong because the statements previously added are not detected being in the list of statements.

Multichill added a comment.Via ConduitDec 23 2013, 9:28 PM

I've seen this happen plenty (10+) times. How to reproduce:

  • Add a new claim (new property) to a page
  • Add a second claim with the same property
  • Try to add a third claim to the same property -> POOF
Magnus added a comment.Via ConduitJan 9 2014, 7:15 PM

For completeness' sake, it can happen for the second claim already.

Addshore added a comment.Via ConduitJan 20 2014, 12:16 PM

Exception Caught: Specified index is out of bounds"

#0 extensions\Wikibase\vendor\wikibase\data-model\src\Wikibase\DataModel\ByPropertyIdArray.php(432): Wikibase\DataModel\ByPropertyIdArray->moveObjectToIndex(Object(Wikibase\DataModel\Claim\Statement), 3)
#1 extensions\Wikibase\repo\includes\ChangeOp\ChangeOpClaim.php(100): Wikibase\DataModel\ByPropertyIdArray->addObjectAtIndex(Object(Wikibase\DataModel\Claim\Statement), 3)
#2 extensions\Wikibase\repo\includes\api\SetClaim.php(64): Wikibase\ChangeOp\ChangeOpClaim->apply(Object(Wikibase\DataModel\Entity\Item))
#3 includes\api\ApiMain.php(861): Wikibase\Api\SetClaim->execute()
#4 includes\api\ApiMain.php(362): ApiMain->executeAction()
#5 includes\api\ApiMain.php(333): ApiMain->executeActionWithErrorHandling()
#6 api.php(76): ApiMain->execute()
#7 {main}~

Occours whenever the index submitted to wbsetclaim is 2 above the number of claims currently in the item for the baserevid that has been submitted.

i.e. 1 claim on item for baserevid 888 >> submit a new claim with index 3 >> Exception

gerritbot added a comment.Via ConduitJan 20 2014, 1:04 PM

Change 108503 had a related patch set uploaded by Addshore:
Clean up error for claim index out of bounds

https://gerrit.wikimedia.org/r/108503

gerritbot added a comment.Via ConduitJan 20 2014, 3:50 PM

Change 108527 had a related patch set uploaded by Addshore:
Implement hack to avoid UI throwing this error

https://gerrit.wikimedia.org/r/108527

gerritbot added a comment.Via ConduitJan 20 2014, 9:54 PM

Change 108503 merged by Jeroen De Dauw:
Clean up error for claim index out of bounds

https://gerrit.wikimedia.org/r/108503

gerritbot added a comment.Via ConduitJan 21 2014, 1:07 PM

Change 108672 had a related patch set uploaded by Addshore:
Clean up error for claim index out of bounds

https://gerrit.wikimedia.org/r/108672

gerritbot added a comment.Via ConduitJan 21 2014, 1:10 PM

Change 108672 merged by jenkins-bot:
Clean up error for claim index out of bounds

https://gerrit.wikimedia.org/r/108672

gerritbot added a comment.Via ConduitJan 21 2014, 1:32 PM

Change 108527 merged by jenkins-bot:
Implement hack to avoid UI throwing this error

https://gerrit.wikimedia.org/r/108527

Add Comment

Column Prototype
This is a very early prototype of a persistent column. It is not expected to work yet, and leaving it open will activate other new features which will break things. Press "\" (backslash) on your keyboard to close it now.