hashicorp/nomad · error

failed to load CNI config file %s: %v

Error message

failed to load CNI config file %s: %v

What it means

Fires in loadCNIConf when cnilibrary.ConfListFromFile (or ConfFromFile) cannot parse the candidate CNI config file — the file exists but its .conflist/.conf/.json content is malformed.

Source

Thrown at client/allocrunner/networking_cni.go:575

	// files contains the network config files associated with cni network.
	// Use lexicographical way as a defined order for network config files.
	sort.Strings(files)
	for _, confFile := range files {
		if strings.HasSuffix(confFile, ".conflist") {
			confList, err := cnilibrary.ConfListFromFile(confFile)
			if err != nil {
				return nil, fmt.Errorf("failed to load CNI config list file %s: %v", confFile, err)
			}
			if confList.Name == name {
				return &cniConfParser{
					listBytes: confList.Bytes,
				}, nil
			}
		} else {
			conf, err := cnilibrary.ConfFromFile(confFile)
			if err != nil {
				return nil, fmt.Errorf("failed to load CNI config file %s: %v", confFile, err)
			}
			if conf.Network.Name == name {
				return &cniConfParser{
					confBytes: conf.Bytes,
				}, nil
			}
		}
	}

	return nil, fmt.Errorf("CNI network config not found for name %q", name)
}

// Teardown calls the CNI plugins with the delete action
func (c *cniNetworkConfigurator) Teardown(ctx context.Context, alloc *structs.Allocation, spec *drivers.NetworkIsolationSpec) error {
	if err := c.ensureCNIInitialized(); err != nil {
		return err
	}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Fix syntax/schema errors in the CNI .conf file
  2. Verify the cniVersion in the config is supported
  3. Re-generate the config for the installed CNI plugin version
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at client/allocrunner/networking_cni.go:575 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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