hashicorp/nomad · error

DestroyNetwork RPC not supported by driver

Error message

DestroyNetwork RPC not supported by driver

What it means

Driver server capability guard in DestroyNetwork: the driver plugin does not implement DriverNetworkManager, so network lifecycle RPCs cannot be served. Only drivers that must create their own network namespaces implement it.

Source

Thrown at plugins/drivers/server.go:435

	if !ok {
		return nil, fmt.Errorf("CreateNetwork RPC not supported by driver")
	}

	spec, created, err := nm.CreateNetwork(req.GetAllocId(), networkCreateRequestFromProto(req))
	if err != nil {
		return nil, err
	}

	return &proto.CreateNetworkResponse{
		IsolationSpec: NetworkIsolationSpecToProto(spec),
		Created:       created,
	}, nil
}

func (b *driverPluginServer) DestroyNetwork(ctx context.Context, req *proto.DestroyNetworkRequest) (*proto.DestroyNetworkResponse, error) {
	nm, ok := b.impl.(DriverNetworkManager)
	if !ok {
		return nil, fmt.Errorf("DestroyNetwork RPC not supported by driver")
	}

	err := nm.DestroyNetwork(req.AllocId, NetworkIsolationSpecFromProto(req.IsolationSpec))
	if err != nil {
		return nil, err
	}

	return &proto.DestroyNetworkResponse{}, nil
}

func (b *driverPluginServer) Shutdown(ctx context.Context, req *proto.ShutdownRequest) (*proto.ShutdownResponse, error) {
	// Shutdown is optional so check if the plugin has implemented
	// the Shutdowner interface and simply return if it does not.
	s, ok := b.impl.(DriverShutdowner)
	if !ok {
		return &proto.ShutdownResponse{}, nil
	}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Use a driver implementing DriverNetworkManager so create/destroy are symmetric.
  2. Upgrade the driver plugin to a version that implements DriverNetworkManager.
  3. Skip network destroy for drivers without the capability; ensure the scheduler does not create network specs for such drivers in the first place.

Example fix

// before
err := client.DestroyNetwork(allocID, spec) // against non-network driver
// after
if _, ok := drv.(drivers.DriverNetworkManager); ok {
	err = client.DestroyNetwork(allocID, spec)
}
Defensive patterns

Strategy: type-guard

Validate before calling

// Only call destroy on drivers known to implement network management
if _, ok := drv.(drivers.DriverNetworkManager); !ok {
	return nil // nothing to tear down
}

Type guard

func supportsNetworkManager(d interface{}) bool {
	_, ok := d.(drivers.DriverNetworkManager)
	return ok
}

Try / catch

err := client.DestroyNetwork(ctx, req)
if err != nil && err.Error() == "DestroyNetwork RPC not supported by driver" {
	// treat as no-op cleanup; log instead of failing GC
}

Prevention

When it happens

Trigger: Calling DestroyNetwork (network teardown after task exit / alloc GC) against a driver plugin whose implementation does not satisfy DriverNetworkManager.

Common situations: Post-stop cleanup of a network namespace for a driver that never supported network isolation; stale hooks calling destroy on an upgraded/downgraded plugin binary without the capability.

Related errors


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/40686f1820ff84bd. Report an issue: GitHub.