kubernetes/kops · error

Failed to create new Network object: %v

Error message

Failed to create new Network object: %v

What it means

Once exactly one network is found, Network.Find converts it into a task via NewNetworkTaskFromCloud; any error from that constructor is wrapped with this message. The constructor mostly copies fields, so failures here are rare and typically come from unexpected nil/missing data on the returned network object.

Source

Thrown at upup/pkg/fi/cloudup/openstacktasks/network.go:81

	cloud := context.T.Cloud.(openstack.OpenstackCloud)
	opt := networks.ListOpts{
		ID:   fi.ValueOf(n.ID),
		Name: fi.ValueOf(n.Name),
	}
	ns, err := cloud.ListNetworks(opt)
	if err != nil {
		return nil, err
	}
	if ns == nil {
		return nil, nil
	} else if len(ns) != 1 {
		return nil, fmt.Errorf("found multiple networks with name: %s", fi.ValueOf(n.Name))
	}
	v := ns[0]
	actual, err := NewNetworkTaskFromCloud(cloud, n.Lifecycle, &v, n.Tag)
	if err != nil {
		return nil, fmt.Errorf("Failed to create new Network object: %v", err)
	}
	n.ID = actual.ID
	return actual, nil
}

func (c *Network) Run(context *fi.CloudupContext) error {
	return fi.CloudupDefaultDeltaRunMethod(c, context)
}

func (_ *Network) CheckChanges(a, e, changes *Network) error {
	if a == nil {
		if e.Name == nil {
			return fi.RequiredField("Name")
		}
	} else {
		if changes.ID != nil {
			return fi.CannotChangeField("ID")
		}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Inspect the wrapped inner error to see which field/construction step failed.
  2. Verify the Neutron API version and that required extensions are enabled: openstack extension list.
  3. Re-run with klog verbosity (kops ... -v=4) to see the raw network listing; if the API returns partial objects, upgrade the OpenStack/neutron deployment.
  4. If caused by a kOps/gophercloud version issue, upgrade kops to a release matching your OpenStack version.

Example fix

// before: neutron returns network without expected fields (extension missing)
Failed to create new Network object: ...
// after: enable required extension / upgrade, then retry
$ openstack extension list | grep availability-zone
$ kops update cluster --name mycluster --yes
Defensive patterns

Strategy: retry

Validate before calling

net := neutronNetworkGet(networkID)
if net == nil || net.Name == "" || net.ID == "" {
	return fmt.Errorf("neutron returned an incomplete network object; check API version/extensions")
}

Try / catch

if err := kopsUpdate(); err != nil {
	if strings.Contains(err.Error(), "Failed to create new Network object") {
		// usually an API/version issue: refresh discovery and retry once
		refreshNeutronExtensions()
		return retryOnce()
	}
	return err
}

Prevention

When it happens

Trigger: NewNetworkTaskFromCloud returns an error while building the Network task from the single listed network — practically only when the network object lacks expected data or a future code path in the constructor fails.

Common situations: Corrupted/empty Neutron responses (API extension returning partial objects); API version mismatch where fields expected by the task are absent; bugs after upgrading gophercloud/openstack plugins.

Related errors


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/e9aee530437c16c4. Report an issue: GitHub.