Add fail fast checks to prevent null message, see #2800