> Let's assume technology-wise, there are indeed no records kept, everything is ephemeral. Should the court order then apply to those chats?
No, there is no record to be kept.
> Now assume that the programmer of the app made an error, and accidentally records are kept for 24 hours. Should the court order now apply to those records?
Yes, the court order applies indiscriminately to all records no matter why or how they were made.