{"record":{"id":"caaeb8c58def6e00","repo":"hashicorp/vagrant","slug":"the-configured-network-subnet-is-not-valid-for-the","errorCode":null,"errorMessage":"The configured network subnet is not valid for the defined network.\nPlease update the network settings and try again.\n\n  Configured subnet: %{subnet}\n  Network name:      %{network_name}","messagePattern":"The configured network subnet is not valid for the defined network\\.\nPlease update the network settings and try again\\.\n\n  Configured subnet: %(.+?)\n  Network name:      %(.+?)","errorType":"exception","errorClass":"VagrantPlugins::DockerProvider::Errors::NetworkSubnetInvalid","httpStatus":null,"severity":"error","filePath":"plugins/providers/docker/action/prepare_networks.rb","lineNumber":76,"sourceCode":"\n        # Validates that the provided options are compatible with a\n        # pre-existing network. Raises exceptions on invalid configurations\n        #\n        # @param [String] network_name Name of the network\n        # @param [Hash] root_options Root networking options\n        # @param [Hash] network_options Docker scoped networking options\n        # @param [Driver] driver Docker driver\n        # @return [Boolean]\n        def validate_network_configuration!(network_name, root_options, network_options, driver)\n          if root_options[:ip] &&\n              driver.network_containing_address(root_options[:ip]) != network_name\n            raise Errors::NetworkAddressInvalid,\n              address: root_options[:ip],\n              network_name: network_name\n          end\n          if network_options[:subnet] &&\n              driver.network_containing_address(network_options[:subnet]) != network_name\n            raise Errors::NetworkSubnetInvalid,\n              subnet: network_options[:subnet],\n              network_name: network_name\n          end\n          true\n        end\n\n        # Generate configuration for private network\n        #\n        # @param [Hash] root_options Root networking options\n        # @param [Hash] net_options Docker scoped networking options\n        # @param [Hash] env Local call env\n        # @return [String, Hash] Network name and updated network_options\n        def process_private_network(root_options, network_options, env)\n          if root_options[:name] && validate_network_name!(root_options[:name], env)\n            network_name = root_options[:name]\n          end\n\n          if root_options[:type].to_s == \"dhcp\"","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/providers/docker/action/prepare_networks.rb#L58-L94","documentation":"Companion check in validate_network_configuration!: when docker-scoped options carry :subnet, the docker network containing that subnet must be the same network Vagrant resolved (driver.network_containing_address(subnet) == network_name). A subnet that maps to a different existing network raises NetworkSubnetInvalid with the subnet and network name.","triggerScenarios":"Setting a subnet through docker_network__* scoped options that conflicts with the existing named docker network being reused - e.g. docker_network__subnet: \"192.168.50.0/24\" while the named network is 10.9.8.0/24.","commonSituations":"Stale per-provider subnet overrides after the shared docker network was recreated with a new range; copy-pasted overrides between projects with different ranges.","solutions":["Align the docker_network__subnet value with the network's actual subnet (`docker network inspect`)","Remove the subnet override and let Vagrant derive addressing from the existing network","Recreate the docker network with the desired subnet, then run vagrant up again"],"exampleFix":"# before\nconfig.vm.network \"private_network\", name: \"mynet\",\n  docker_network__subnet: \"192.168.50.0/24\"\n# mynet is 10.9.8.0/24 -> NetworkSubnetInvalid\n\n# after\nconfig.vm.network \"private_network\", name: \"mynet\",\n  docker_network__subnet: \"10.9.8.0/24\"","handlingStrategy":"validation","validationCode":"# confirm the override subnet matches the network before up\nACTUAL=$(docker network inspect mynet --format '{{(index .IPAM.Config 0).Subnet}}')\n[ \"$ACTUAL\" = \"10.9.8.0/24\" ] || echo \"override subnet mismatch: network is $ACTUAL\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep docker_network__subnet overrides next to the `docker network inspect` output they mirror","Remove per-provider subnet overrides once the shared network is stable","Recreate networks deliberately (delete + create with the target subnet) instead of editing overrides"],"tags":["vagrant","docker","network","subnet"],"backgroundTag":"subnet-mismatch","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}