diff --git a/src/ruby/ext/grpc/rb_call.c b/src/ruby/ext/grpc/rb_call.c
index dc80d18b4599af656d040cc0dac2d412022ede49..f5fdbb2ffd721967dacdee7c26b000395690e1e5 100644
--- a/src/ruby/ext/grpc/rb_call.c
+++ b/src/ruby/ext/grpc/rb_call.c
@@ -359,7 +359,7 @@ static int grpc_rb_md_ary_fill_hash_cb(VALUE key, VALUE val, VALUE md_ary_obj) {
       md_ary->metadata[md_ary->count].value_length = value_len;
       md_ary->count += 1;
     }
-  } else {
+  } else if (TYPE(val) == T_STRING) {
     value_str = RSTRING_PTR(val);
     value_len = RSTRING_LEN(val);
     if (!grpc_is_binary_header(key_str, key_len) &&
@@ -373,6 +373,10 @@ static int grpc_rb_md_ary_fill_hash_cb(VALUE key, VALUE val, VALUE md_ary_obj) {
     md_ary->metadata[md_ary->count].value = value_str;
     md_ary->metadata[md_ary->count].value_length = value_len;
     md_ary->count += 1;
+  } else {
+    rb_raise(rb_eArgError,
+               "Header values must be of type string or array");
+    return ST_STOP;
   }
 
   return ST_CONTINUE;
diff --git a/src/ruby/spec/generic/client_stub_spec.rb b/src/ruby/spec/generic/client_stub_spec.rb
index 5e13c25fcf3e6d1e70f416006a2609cc1af2363c..dd8e2e9f7a2619a338f4ad194ba418ab9120a579 100644
--- a/src/ruby/spec/generic/client_stub_spec.rb
+++ b/src/ruby/spec/generic/client_stub_spec.rb
@@ -193,44 +193,45 @@ describe 'ClientStub' do
   describe '#client_streamer' do
     shared_examples 'client streaming' do
       before(:each) do
+        server_port = create_test_server
+        host = "localhost:#{server_port}"
+        @stub = GRPC::ClientStub.new(host, @cq, :this_channel_is_insecure)
+        @options = { k1: 'v1', k2: 'v2' }
         @sent_msgs = Array.new(3) { |i| 'msg_' + (i + 1).to_s }
         @resp = 'a_reply'
       end
 
       it 'should send requests to/receive a reply from a server' do
-        server_port = create_test_server
-        host = "localhost:#{server_port}"
         th = run_client_streamer(@sent_msgs, @resp, @pass)
-        stub = GRPC::ClientStub.new(host, @cq, :this_channel_is_insecure)
-        expect(get_response(stub)).to eq(@resp)
+        expect(get_response(@stub)).to eq(@resp)
         th.join
       end
 
       it 'should send metadata to the server ok' do
-        server_port = create_test_server
-        host = "localhost:#{server_port}"
-        th = run_client_streamer(@sent_msgs, @resp, @pass,
-                                 k1: 'v1', k2: 'v2')
-        stub = GRPC::ClientStub.new(host, @cq, :this_channel_is_insecure)
-        expect(get_response(stub)).to eq(@resp)
+        th = run_client_streamer(@sent_msgs, @resp, @pass, @options)
+        expect(get_response(@stub)).to eq(@resp)
         th.join
       end
 
       it 'should raise an error if the status is not ok' do
-        server_port = create_test_server
-        host = "localhost:#{server_port}"
         th = run_client_streamer(@sent_msgs, @resp, @fail)
-        stub = GRPC::ClientStub.new(host, @cq, :this_channel_is_insecure)
-        blk = proc { get_response(stub) }
+        blk = proc { get_response(@stub) }
         expect(&blk).to raise_error(GRPC::BadStatus)
         th.join
       end
+
+      it 'should raise ArgumentError if metadata contains invalid values' do
+        @options.merge!(k3: 3)
+        expect do
+          get_response(@stub)
+        end.to raise_error(ArgumentError,
+                           /Header values must be of type string or array/)
+      end
     end
 
     describe 'without a call operation' do
       def get_response(stub)
-        stub.client_streamer(@method, @sent_msgs, noop, noop,
-                             k1: 'v1', k2: 'v2')
+        stub.client_streamer(@method, @sent_msgs, noop, noop, @options)
       end
 
       it_behaves_like 'client streaming'
@@ -239,7 +240,7 @@ describe 'ClientStub' do
     describe 'via a call operation' do
       def get_response(stub)
         op = stub.client_streamer(@method, @sent_msgs, noop, noop,
-                                  return_op: true, k1: 'v1', k2: 'v2')
+                                  @options.merge(return_op: true))
         expect(op).to be_a(GRPC::ActiveCall::Operation)
         op.execute
       end