hashicorp/nomad · critical

failed to initialize network configurator: %v

Error message

failed to initialize network configurator: %v

What it means

During initRunnerHooks, newNetworkConfigurator failed to construct the component that assigns/tears down the alloc's network (host or CNI-based). The alloc cannot proceed with hook setup. The underlying cause (misconfigured client network settings, CNI errors) is embedded via %v.

Source

Thrown at client/allocrunner/alloc_runner_hooks.go:104

func (ar *allocRunner) initRunnerHooks(config *clientconfig.Config) error {
	hookLogger := ar.logger.Named("runner_hook")

	// create health setting shim
	hs := &allocHealthSetter{ar}

	// create network isolation setting shim
	ns := &allocNetworkIsolationSetter{ar: ar}

	// build the network manager
	nm, err := newNetworkManager(ar.Alloc(), ar.driverManager)
	if err != nil {
		return fmt.Errorf("failed to configure network manager: %v", err)
	}

	// create network configurator
	nc, err := newNetworkConfigurator(hookLogger, ar.Alloc(), config)
	if err != nil {
		return fmt.Errorf("failed to initialize network configurator: %v", err)
	}

	// Create the alloc directory hook. This is run first to ensure the
	// directory path exists for other hooks.
	alloc := ar.Alloc()

	ar.runnerHooks = []interfaces.RunnerHook{
		newIdentityHook(hookLogger, ar.widmgr),
		newAllocDirHook(hookLogger, ar.allocDir),
		newMaxRunDurationHook(hookLogger, alloc, ar.clientBaseLabels, ar.EnforceMaxRunDurationTimeout),
		newConsulHook(consulHookConfig{
			alloc:                   ar.alloc,
			allocdir:                ar.allocDir,
			widmgr:                  ar.widmgr,
			consulConfigs:           ar.clientConfig.GetConsulConfigs(hookLogger),
			consulClientConstructor: consul.NewConsulClientFactory(config),
			hookResources:           ar.hookResources,
			logger:                  hookLogger,

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Inspect the wrapped cause for the concrete misconfiguration (unknown host network, CNI load failure)
  2. Fix client.hcl network settings: ensure referenced host networks/interfaces exist
  3. Verify cni_path points to a directory containing the required CNI binaries and valid network confs
  4. Restart the Nomad client after fixing network configuration so fingerprinting reruns

Example fix

// before (client.hcl)
host_networks = ["wrong-name"]
// after
host_network "public" {
  interface = "eth0"
  cidr      = "10.0.0.0/24"
}
Defensive patterns

Strategy: validation

Validate before calling

// preflight client network config
for _, hn := range cfg.Client.HostNetworks {
  if !interfaceExists(hn.Interface) { return fmt.Errorf("host network %q missing", hn.Name) }
}
if _, err := os.Stat(filepath.Join(cfg.Client.CNIBinDir, "bridge")); err != nil {
  return fmt.Errorf("CNI plugins missing in %s", cfg.Client.CNIBinDir)
}

Prevention

When it happens

Trigger: newNetworkConfigurator errors when client config for host networks is invalid (host_networks referencing unknown interfaces), or CNI config is malformed/missing for bridge mode allocs.

Common situations: client.host_networks naming a network that doesn't exist on the host; missing or invalid /opt/cni/bin plugins or CNI conflist; mismatch between nomad client config cni_path and actual CNI install; bridge_network_name pointing at a nonexistent bridge.

Related errors


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