StateFEN lacks info indicating the last time a piece taken or pawn advanced.
StateFEN lacks info needed for check of the possible outcomes repeating 3 times.
The king is not in check before castlingwhen attempting to castle.
What if the side lacks a legal move?
What isif the FEN state is invalid due to position? (castling flag OK yet no rook, en pass with no pawn, white to move yet no piece.)
How much error checking is desired?
Non-standard board support
Hmm, with more than 2 rooks, 1 king, I see a need for more than 2 castling flags.