The problem have been solved.
The error occur because there is another trigger associated with the table 'platformmapkeys' that checks the existance of the platformid value just generated from platform table, since the transaction it's end yet so it will always fail.