SCID versions 5.0.2 and 5.1.0 crashed when importing the PGN in attachment. After that, the database is corrupted and cannot be opened.
This error message appears in the console before the crash :
scid: /run/build/scid/src/indexentry.h:202: void IndexEntry::SetNumHalfMoves(ushort): Assertion `GetNumHalfMoves() == b' failed.
Thanks for the report.
The issue you experienced occurred because assertions were enabled in this specific build. Assertions are a debugging mechanism designed to halt the program immediately when an unexpected condition is encountered. While this is useful for developers to find bugs, in a normal-use scenario this sudden halt can interrupt file operations and lead to unpredictable outcomes, such as the database corruption that occurred in this case.
The technical details:
- In the index structure of SCID4 or SCID5 databases, the number of moves in a game is stored using a 10-bit field. This means the maximum value that can be represented is 1023 half-moves (plies), or 511 full moves.
- That PGN contains an exceptionally long game by Nakamura consisting of 810 full moves:
https://youtu.be/AG1liGHlZY4?t=1534
- When attempting to import the game, the assert detected that the move count could not be correctly represented in the index and immediately halted the program, causing the database corruption.
- If assertions had not been enabled, the program would have continued operating normally. The game would have been imported and could be loaded with all the moves. The anomaly would be that the move count displayed in the gamelist would be incorrect.
Finally, it may be possible to recover the corrupted database:
https://github.com/benini/scid/issues/140
Thank for your answer. I made a new build of SCID 5.0.2 on Gentoo with the
-DNDEBUGflag and I can import the PGN with this crazy game of Nakamura ! It count 298 moves in the game list but the game can indeed be loaded with all the 810 moves.Finally, instead of trying to repair the corrupted si4 database, I recreated a new one in the si5 format.
Last edit: sphilip 2026-01-13
Also, the SCID 5.1.0 I tested was installed with Flatpak and I noticed that you are the also the maintainer.
It seems that this Flatpak release doesn't remove the assertions.
Thanks! I have updated the Flatpak manifest, it should be fixed.