hashicorp/nomad · error

failed to detect CNI config file: %v

Error message

failed to detect CNI config file: %v

What it means

Fires in loadCNIConf when scanning the CNI confDir for network config files fails at the filesystem level (unreadable directory, permission error); no CNI network configuration could be located.

Source

Thrown at client/allocrunner/networking_cni.go:553

// getOpt produces a cni.Opt to load with cni.CNI.Load()
func (c *cniConfParser) getOpt() (cni.Opt, error) {
	if len(c.listBytes) > 0 {
		return cni.WithConfListBytes(c.listBytes), nil
	}
	if len(c.confBytes) > 0 {
		return cni.WithConf(c.confBytes), nil
	}
	// theoretically should never be reached
	return nil, errors.New("no CNI network config found")
}

// loadCNIConf looks in confDir for a CNI config with the specified name
func loadCNIConf(confDir, name string) (*cniConfParser, error) {
	files, err := cnilibrary.ConfFiles(confDir, []string{".conf", ".conflist", ".json"})
	switch {
	case err != nil:
		return nil, fmt.Errorf("failed to detect CNI config file: %v", err)
	case len(files) == 0:
		return nil, fmt.Errorf("no CNI network config found in %s", confDir)
	}

	// 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
			}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Verify the cni_path client config points at an existing directory
  2. Check directory permissions for the Nomad client user
  3. Install the required .conf/.conflist/.json CNI config file
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at client/allocrunner/networking_cni.go:553 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/91bb633a8f3ceb82. Report an issue: GitHub.