The following is pure speculation:
1. You didn't call the police when you entered the library. Or did you go in through the door without a detector? Maybe you borrowed a book before and the magnetic stripe fell out of it. You don't know. It's possible.
2. If the above situation is ruled out, then it is very likely that someone framed "Madam". Oh, think about the whole story. Did your bag leave you in the library? Did someone secretly put a magnetic stripe in your schoolbag?
Hehe, are you okay? Good luck.