Hi!
Unfortunately Nitrokey HSM does not have factory-reset. Once the SO-PIN is lost, and all attempts are used up for User PIN as well, device becomes blocked and unusable.
From SmartCardHSM · OpenSC/OpenSC Wiki · GitHub
The SO-PIN has a retry counter of 15 and can not be unblocked. Blocking the SO-PIN will prevent any further token initialization or PIN unblock.
Potentially, in case the SO PIN was ever changed, perhaps the format was wrong as in: Nitrokey HSM SO-PIN conversion - #4 by szszszsz.
Other problem with the PIN might be its invalid length, like here: Nitrokey HSM - keypairgen fails with 16-digit user PIN - #3 by cda (edit: apparently only with OpenSC older than v0.16).
As a last resort, you can look at forum search - perhaps this would remind you anything: Search results for 'HSM PIN' - Nitrokey Support.