diff --git a/common-channel.c b/common-channel.c
index b846f2858ce43a2c85fd76cb8c4f32d27f655ed5..b3984c4cd8f91feeec3493d456073f66b58fd5fa 100644
--- a/common-channel.c
+++ b/common-channel.c
@@ -971,6 +971,7 @@ void recv_msg_channel_open() {
 
 	if (channel == NULL) {
 		TRACE(("newchannel returned NULL"))
+		errtype = SSH_OPEN_RESOURCE_SHORTAGE;
 		goto failure;
 	}