diff --git a/src/box/alter.cc b/src/box/alter.cc
index 89bd4d90839529d9fd8f3a1c26815555d5985bc0..c065a4a210aaaac7ea30f42c68ebc9a77b30e0ce 100644
--- a/src/box/alter.cc
+++ b/src/box/alter.cc
@@ -2189,10 +2189,13 @@ on_replace_dd_space(struct trigger * /* trigger */, void *event)
 			    BOX_SPACE_FIELD_ID, &old_id) != 0)
 		return -1;
 	struct space *old_space = space_by_id(old_id);
+	struct space_def *def = NULL;
+	if (new_tuple != NULL) {
+		uint32_t errcode = (old_tuple == NULL) ?
+			ER_CREATE_SPACE : ER_ALTER_SPACE;
+		def = space_def_new_from_tuple(new_tuple, errcode, region);
+	}
 	if (new_tuple != NULL && old_space == NULL) { /* INSERT */
-		struct space_def *def =
-			space_def_new_from_tuple(new_tuple, ER_CREATE_SPACE,
-						 region);
 		if (def == NULL)
 			return -1;
 		auto def_guard =
@@ -2352,9 +2355,6 @@ on_replace_dd_space(struct trigger * /* trigger */, void *event)
 				 "view can not be altered");
 			return -1;
 		}
-		struct space_def *def =
-			space_def_new_from_tuple(new_tuple, ER_ALTER_SPACE,
-						 region);
 		if (def == NULL)
 			return -1;
 		auto def_guard =