Project

General

Profile

Actions

Bug #21718

open

TypeError:wrong argument type ... (expected Array)

Bug #21718: TypeError:wrong argument type ... (expected Array)

Added by vo.x (Vit Ondruch) about 5 hours ago. Updated 28 minutes ago.

Status:
Open
Assignee:
-
Target version:
-
ruby -v:
ruby 4.0.0dev (2025-11-18 master 85abc59c32) +PRISM [x86_64-linux]
[ruby-core:123930]

Description

Testing Ruby 4.0 on Fedora, we observe these errors in MiniMagick

1) MiniMagick::Image#composite yields an optional block
      Failure/Error: yield composite if block_given?

TypeError:
        wrong argument type MiniMagick::Tool (expected Array)
      # ./lib/mini_magick/image.rb:515:in 'block in MiniMagick::Image#composite'
      # ./lib/mini_magick/tool.rb:34:in 'MiniMagick::Tool.new'
      # ./lib/mini_magick.rb:28:in 'block (2 levels) in module:MiniMagick'
      # ./lib/mini_magick/image.rb:514:in 'MiniMagick::Image#composite'
      # ./spec/lib/mini_magick/image_spec.rb:609:in 'block (4 levels) in <top (required)>'
      # ./spec/lib/mini_magick/image_spec.rb:610:in 'block (3 levels) in <top (required)>'

and Vagrant / vagrant-libvirt

340) VagrantPlugins::ProviderLibvirt::Util::NetworkUtil #libvirt_networks should retrieve the list of networks
        Failure/Error: let(:machine)          { iso_env.machine(:test, :libvirt) }

TypeError:
          wrong argument type Vagrant::Config::V2::DummyConfig (expected Array)
        # /usr/share/vagrant/gems/gems/vagrant-2.3.4/plugins/kernel_v2/config/vm.rb:713:in 'Kernel#inspect'
        # /usr/share/vagrant/gems/gems/vagrant-2.3.4/plugins/kernel_v2/config/vm.rb:713:in 'VagrantPlugins::Kernel_V2::VMConfig#get_provider_config'
        # /usr/share/vagrant/gems/gems/vagrant-2.3.4/lib/vagrant/vagrantfile.rb:75:in 'Vagrant::Vagrantfile#machine'
        # /usr/share/vagrant/gems/gems/vagrant-2.3.4/lib/vagrant/environment.rb:740:in 'Vagrant::Environment#machine'
        # ./spec/support/unit_context.rb:26:in 'block (2 levels) in <top (required)>'
        # ./spec/support/unit_context.rb:37:in 'block (2 levels) in <top (required)>'
        # ./spec/support/unit_context.rb:51:in 'block (3 levels) in <top (required)>'
        # ./spec/support/unit_context.rb:43:in 'block (2 levels) in <top (required)>'
        # /usr/share/rubygems/rubygems.rb:303:in 'Kernel#load'
        # /usr/share/rubygems/rubygems.rb:303:in 'Gem.activate_and_load_bin_path'

Trying to investigate closer the vagrant-libvirt case, I really cannot wrap my head around it, because it fails with innocently looking result.inspect 1. The image_magick fails at yield composite if block_given? line, so I suspect that the yield composite is the specific place.

Since this does not make any sense to me, I have grepped the Ruby source code for:

$ grep -R -e TypeError | grep "wrong argument type.*Array"

... snip ...

prism/extension.c:        rb_raise(rb_eTypeError, "wrong argument type %"PRIsVALUE" (expected Array)", rb_obj_class(scopes));
prism/extension.c:                rb_raise(rb_eTypeError, "wrong argument type %"PRIsVALUE" (expected Array)", rb_obj_class(locals));
prism/extension.c:                rb_raise(rb_eTypeError, "wrong argument type %"PRIsVALUE" (expected Array)", rb_obj_class(names));

This seems to come from https://github.com/ruby/prism/commit/21abb6b7c499b41a951eba7c8219c336a656da40 . So is it the reason? Not sure.

Actions

Also available in: PDF Atom