diff --git a/src/box/lua/space.cc b/src/box/lua/space.cc
index 7aa0b6661e4417ac6f647b37c19f6df54c1db5a7..9dfc97b6a49c39991c4a31c3306c25459ab73537 100644
--- a/src/box/lua/space.cc
+++ b/src/box/lua/space.cc
@@ -510,7 +510,7 @@ lbox_space_frommap(struct lua_State *L)
 
 	lua_replace(L, 1);
 	lua_settop(L, 1);
-	return lbox_tuple_new(L);
+	return luaT_tuple_new(L, space->format);
 usage_error:
 	return luaL_error(L, "Usage: space:frommap(map, opts)");
 }
diff --git a/src/box/lua/tuple.c b/src/box/lua/tuple.c
index 5f2bfc80728b508887464f42f8176b0e272c5316..60c1a3999a9135f487e8b47ff8e6409c4996d51e 100644
--- a/src/box/lua/tuple.c
+++ b/src/box/lua/tuple.c
@@ -94,7 +94,7 @@ luaT_istuple(struct lua_State *L, int narg)
 }
 
 int
-lbox_tuple_new(lua_State *L)
+luaT_tuple_new(struct lua_State *L, struct tuple_format *format)
 {
 	int argc = lua_gettop(L);
 	if (argc < 1) {
@@ -120,8 +120,7 @@ lbox_tuple_new(lua_State *L)
 	}
 	mpstream_flush(&stream);
 
-	box_tuple_format_t *fmt = box_tuple_format_default();
-	struct tuple *tuple = box_tuple_new(fmt, buf->buf,
+	struct tuple *tuple = box_tuple_new(format, buf->buf,
 					   buf->buf + ibuf_used(buf));
 	if (tuple == NULL)
 		return luaT_error(L);
@@ -131,6 +130,12 @@ lbox_tuple_new(lua_State *L)
 	return 1;
 }
 
+static int
+lbox_tuple_new(lua_State *L)
+{
+	return luaT_tuple_new(L, box_tuple_format_default());
+}
+
 static int
 lbox_tuple_gc(struct lua_State *L)
 {
diff --git a/src/box/lua/tuple.h b/src/box/lua/tuple.h
index 5d7062eb89f692c3b77f26b89f84475568388e07..ba7f01f4b031c7fbffe9a0fa5715430f609b7bfe 100644
--- a/src/box/lua/tuple.h
+++ b/src/box/lua/tuple.h
@@ -37,6 +37,7 @@ extern "C" {
 #endif /* defined(__cplusplus) */
 
 struct tuple;
+struct tuple_format;
 typedef struct tuple box_tuple_t;
 struct lua_State;
 struct mpstream;
@@ -67,7 +68,7 @@ luaT_istuple(struct lua_State *L, int idx);
 /** \endcond public */
 
 int
-lbox_tuple_new(struct lua_State *L);
+luaT_tuple_new(struct lua_State *L, struct tuple_format *format);
 
 static inline int
 luaT_pushtupleornil(struct lua_State *L, struct tuple *tuple)
diff --git a/test/box/tuple.result b/test/box/tuple.result
index 16aa66b1a195fcb68603b6eea790975d9d5a131d..82ad8404d2122e6f6e9c340f0482dcc16befafa1 100644
--- a/test/box/tuple.result
+++ b/test/box/tuple.result
@@ -1069,13 +1069,13 @@ format = {}
 format[1] = {name = 'aaa', type = 'unsigned'}
 ---
 ...
-format[2] = {name = 'bbb', type = 'unsigned'}
+format[2] = {name = 'bbb', type = 'unsigned', is_nullable = true}
 ---
 ...
-format[3] = {name = 'ccc', type = 'unsigned'}
+format[3] = {name = 'ccc', type = 'unsigned', is_nullable = true}
 ---
 ...
-format[4] = {name = 'ddd', type = 'unsigned'}
+format[4] = {name = 'ddd', type = 'unsigned', is_nullable = true}
 ---
 ...
 s = box.schema.create_space('test', {format = format})
@@ -1100,7 +1100,7 @@ s:frommap()
 ...
 s:frommap({})
 ---
-- []
+- error: Tuple field 1 required by space format is missing
 ...
 s:frommap({ddd = 1, aaa = 2, ccc = 3, bbb = 4}, {table = true})
 ---
@@ -1211,6 +1211,23 @@ s2:frommap({a="1", k="11"})
 ---
 - ['1', null, null, null, null, null, null, null, null, null, '11']
 ...
+--
+-- gh-4045: space:frommap():tomap() conversion fail
+--
+s2:frommap({a="1", k="11"}):tomap({names_only = true})
+---
+- i: null
+  f: null
+  c: null
+  g: null
+  b: null
+  j: null
+  k: '11'
+  d: null
+  h: null
+  a: '1'
+  e: null
+...
 s2:drop()
 ---
 ...
diff --git a/test/box/tuple.test.lua b/test/box/tuple.test.lua
index 0c89feace1ab0032c4bdb7c1fbe196bc8597e7d8..8030b088430231584e910fef0861c77fd22deef0 100644
--- a/test/box/tuple.test.lua
+++ b/test/box/tuple.test.lua
@@ -354,9 +354,9 @@ box.tuple.bsize == t.bsize
 --
 format = {}
 format[1] = {name = 'aaa', type = 'unsigned'}
-format[2] = {name = 'bbb', type = 'unsigned'}
-format[3] = {name = 'ccc', type = 'unsigned'}
-format[4] = {name = 'ddd', type = 'unsigned'}
+format[2] = {name = 'bbb', type = 'unsigned', is_nullable = true}
+format[3] = {name = 'ccc', type = 'unsigned', is_nullable = true}
+format[4] = {name = 'ddd', type = 'unsigned', is_nullable = true}
 s = box.schema.create_space('test', {format = format})
 s:frommap({ddd = 1, aaa = 2, ccc = 3, bbb = 4})
 s:frommap({ddd = 1, aaa = 2, bbb = 3})
@@ -409,4 +409,10 @@ s2:format({{name="a", type="str"}, {name="b", type="str", is_nullable=true},
            {name="k", type="str", is_nullable=true}});
 test_run:cmd("setopt delimiter ''");
 s2:frommap({a="1", k="11"})
+
+--
+-- gh-4045: space:frommap():tomap() conversion fail
+--
+s2:frommap({a="1", k="11"}):tomap({names_only = true})
+
 s2:drop()