Vercel AI SDK: fixing 'The messages must be a ModelMessage[]' after loading a saved chat
The error says you passed a UIMessage[]. With saved chats, the usual cause is null or Date values your database wrote into stored messages. Here's how to find the field, clean old rows, stop writing new ones and validate on load, on AI SDK 5, 6 and 7.