Is it OK for a form element to shift when a related error message appears?

When designing a form, should I design with enough space between the elements for potential errors?

So that when displaying error messages, the form elements below the error message do not shift, because there was enough space above to display any messages.

Visual examples: input movement on forms when error message

Thanks!