only write valid messages to retry cache