raise exception when key is nil