{"record":{"id":"6a9b38f280bca4e1","repo":"hashicorp/vagrant","slug":"network-settings-specified-in-your-vagrantfile-def-6a9b38","errorCode":null,"errorMessage":"Network settings specified in your Vagrantfile define an invalid\nIP address. Please review the error message below and update your\nVagrantfile network settings:\n\n  Address: %{address}\n  Netmask: %{mask}\n  Error: %{error}","messagePattern":"Network settings specified in your Vagrantfile define an invalid\nIP address\\. Please review the error message below and update your\nVagrantfile network settings:\n\n  Address: %(.+?)\n  Netmask: %(.+?)\n  Error: %(.+?)","errorType":"exception","errorClass":"Vagrant::Errors::NetworkAddressInvalid","httpStatus":null,"severity":"error","filePath":"plugins/providers/virtualbox/action/network.rb","lineNumber":89,"sourceCode":"\n              slot = available_slots.shift\n            end\n\n            # Internal network is a special type\n            if type == :private_network && options[:intnet]\n              type = :internal_network\n            end\n\n            if !options.key?(:type) && options.key?(:ip)\n              begin\n                addr = IPAddr.new(options[:ip])\n                options[:type] = if addr.ipv4?\n                                   :static\n                                 else\n                                   :static6\n                                 end\n              rescue IPAddr::Error => err\n                raise Vagrant::Errors::NetworkAddressInvalid,\n                      address: options[:ip], mask: options[:netmask],\n                      error: err.message\n              end\n            end\n\n            # Configure it\n            data = nil\n            if type == :private_network\n              # private_network = hostonly\n              data = [:hostonly, options]\n            elsif type == :public_network\n              # public_network = bridged\n              data = [:bridged, options]\n            elsif type == :internal_network\n              data = [:intnet, options]\n            end\n\n            # Store it!","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/providers/virtualbox/action/network.rb#L71-L107","documentation":"While classifying Vagrantfile network definitions, the Network action constructs IPAddr.new(options[:ip]) whenever a network block has an :ip but no explicit :type, to decide between :static and :static6. Any IPAddr::Error (invalid address, wrong family, bad mask) is rescued and re-raised as NetworkAddressInvalid with the address, netmask and the underlying parser message.","triggerScenarios":"A `config.vm.network 'private_network'/'public_network', ip: <bad>` value that Ruby's IPAddr rejects: typos ('192.168.1.256'), quotes around CIDR handled wrongly, IPv6 with zone or truncated address, e.g. during `vagrant up`/`reload`/`ssh-config` when networks are configured.","commonSituations":"Typos in static IPs; using a hostname instead of an IP; missing netmask combined with an odd prefix string; ERB templates injecting empty strings for the ip; copy-pasting 'ip: 192.168.33.10' without quotes after a YAML interpolation.","solutions":["Fix the ip value in the Vagrantfile to a literal valid IPv4/IPv6 address (e.g. '192.168.33.10') or CIDR ('10.20.30.40/24')","If you meant DHCP, remove the :ip key entirely and use type: 'dhcp'","Quote values coming from variables/ERB so nil or empty strings never reach ip:","Validate locally: `ruby -r ipaddr -e \"puts IPAddr.new(ARGV[0])\" '<value>'`"],"exampleFix":"# Vagrantfile - before:\nconfig.vm.network 'private_network', ip: '192.168.33.300'   # 300 invalid octet\n\n# after:\nconfig.vm.network 'private_network', ip: '192.168.33.10', netmask: '255.255.255.0'","handlingStrategy":"validation","validationCode":"require 'ipaddr'\ndef valid_vagrant_ip?(v, netmask = nil)\n  IPAddr.new(v.to_s)                      # raises on malformed ip\n  IPAddr.new(\"#{v}/#{netmask || 24}\")      # raises on bad ip/mask combo\n  true\nrescue IPAddr::Error, ArgumentError\n  false\nend\nabort 'bad ip' unless valid_vagrant_ip?('192.168.33.10')","typeGuard":"require 'ipaddr'\ndef vagrant_ip_string?(v)\n  v.is_a?(String) && (IPAddr.new(v) rescue nil) ? true : false\nend","tryCatchPattern":"begin\n  env.cli('up')\nrescue Vagrant::Errors::NetworkAddressInvalid => e\n  d = e.extra_data\n  warn \"Fix network address #{d[:address]}/#{d[:mask]}: #{d[:error]}\"\nend","preventionTips":["Run IPAddr.new on every templated ip value in CI before vagrant up","Quote IPs and default netmask: to nil instead of '' in generated Vagrantfiles","Prefer explicit type: 'dhcp' when no static ip is intended"],"tags":["virtualbox","network","ip-address","vagrantfile","validation"],"backgroundTag":"invalid-ip-address","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}