What is the problem?
When using Special:InvestigateBlock to block a user or IP that already has more than one block against them, this exception is thrown:
[11d9e8a17daed5a3db7a0ee6] /wiki/Special:InvestigateBlock RuntimeException: Can\'t reblock a user with multiple blocks already present. Update calling code for multiblocks, providing a specific block to update.
Backtrace:
from /var/www/html/w/includes/block/BlockUser.php(628)
#0 /var/www/html/w/includes/block/BlockUser.php(566): MediaWiki\Block\BlockUser->placeBlockInternal()
#1 /var/www/html/w/includes/block/BlockUser.php(491): MediaWiki\Block\BlockUser->placeBlockUnsafe()
#2 /var/www/html/w/extensions/CheckUser/src/Investigate/SpecialInvestigateBlock.php(342): MediaWiki\Block\BlockUser->placeBlock()
#3 /var/www/html/w/includes/htmlform/HTMLForm.php(824): MediaWiki\CheckUser\Investigate\SpecialInvestigateBlock->onSubmit()
#4 /var/www/html/w/includes/htmlform/HTMLForm.php(705): MediaWiki\HTMLForm\HTMLForm->trySubmit()
#5 /var/www/html/w/includes/htmlform/HTMLForm.php(721): MediaWiki\HTMLForm\HTMLForm->tryAuthorizedSubmit()
#6 /var/www/html/w/includes/specialpage/FormSpecialPage.php(240): MediaWiki\HTMLForm\HTMLForm->show()
#7 /var/www/html/w/includes/specialpage/SpecialPage.php(729): MediaWiki\SpecialPage\FormSpecialPage->execute()
#8 /var/www/html/w/includes/specialpage/SpecialPageFactory.php(1737): MediaWiki\SpecialPage\SpecialPage->run()
#9 /var/www/html/w/includes/actions/ActionEntryPoint.php(503): MediaWiki\SpecialPage\SpecialPageFactory->executePath()
#10 /var/www/html/w/includes/actions/ActionEntryPoint.php(145): MediaWiki\Actions\ActionEntryPoint->performRequest()
#11 /var/www/html/w/includes/MediaWikiEntryPoint.php(202): MediaWiki\Actions\ActionEntryPoint->execute()
#12 /var/www/html/w/index.php(58): MediaWiki\MediaWikiEntryPoint->run()
#13 {main}I don't know how Special:InvestigateBlock is supposed to handle multiblocks. This might need another task.
Steps to reproduce problem
- On a wiki with Codex Special:Block and Multiblocks enabled ($wgUseCodexSpecialBlock = true; $wgEnableMultiBlocks = true;)
- Use Special:Block to create two blocks against the same user or IP
- Go to Special:InvestigateBlock
- Enter the name of the user or IP from step 2
- Check "Override existing blocks"
- Add a reason
- Submit
Expected behaviour: Not exactly sure what the expected behaviour here should be...
Observed behaviour: The above exception.
Environment
Wiki(s): local docker MediaWiki 1.44.0-alpha (9669d77) 08:30, 3 March 2025. CheckUser 2.5 (3b8b9e1) 07:26, 3 March 2025.
Derived Requirements
- Special:InvestigateBlock must properly handle users or IPs with multiple existing blocks.
- If multiple blocks exist, the system should provide a way to specify which block to update or prevent an override without a clear selection.
- The system should not trigger a RuntimeException.
- Ensure that reblocking a user/IP with multiple blocks does not cause an error.
- If reblocking is allowed, it should either merge, replace, or clearly communicate the expected outcome of the action.
- If reblocking is not allowed, a user-friendly error message should be displayed instead of an exception.
- Implement logging and error handling for reblocking scenarios.
- Block logs should correctly reflect the attempted actions on Special:InvestigateBlock.
- If an action fails, a user-readable message should be logged instead of throwing a system-level exception.
Test Steps
- Test Case 1: Attempt to reblock a user/IP with multiple existing blocks
- Ensure that $wgUseCodexSpecialBlock = true; and $wgEnableMultiBlocks = true; are enabled.
- Navigate to Special:Block and create two separate blocks against the same user/IP.
- Navigate to Special:InvestigateBlock.
- Enter the username/IP from Step 2.
- Check "Override existing blocks" and enter a reason.
- Click Submit.
- ✅ AC1: Confirm that the system handles the request gracefully (e.g., prevents reblocking, allows specifying a block to update, or provides a clear error message)
- Test Case 2: Ensure reblocking a user/IP with a single block works correctly
- Navigate to Special:Block and create one block against a user/IP.
- Go to Special:InvestigateBlock and attempt to reblock the user/IP.
- ✅ AC2: Confirm that the reblock operation is successful and updates the block details correctly.
QA Results - Local
| AC | Status | Details |
|---|---|---|
| 1 | ✅ | T387723#10671659 |
| 2 | ✅ | T387723#10671659 |

