{"record":{"id":"91bb633a8f3ceb82","repo":"hashicorp/nomad","slug":"failed-to-detect-cni-config-file-v","errorCode":null,"errorMessage":"failed to detect CNI config file: %v","messagePattern":"failed to detect CNI config file: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/allocrunner/networking_cni.go","lineNumber":553,"sourceCode":"\n// getOpt produces a cni.Opt to load with cni.CNI.Load()\nfunc (c *cniConfParser) getOpt() (cni.Opt, error) {\n\tif len(c.listBytes) > 0 {\n\t\treturn cni.WithConfListBytes(c.listBytes), nil\n\t}\n\tif len(c.confBytes) > 0 {\n\t\treturn cni.WithConf(c.confBytes), nil\n\t}\n\t// theoretically should never be reached\n\treturn nil, errors.New(\"no CNI network config found\")\n}\n\n// loadCNIConf looks in confDir for a CNI config with the specified name\nfunc loadCNIConf(confDir, name string) (*cniConfParser, error) {\n\tfiles, err := cnilibrary.ConfFiles(confDir, []string{\".conf\", \".conflist\", \".json\"})\n\tswitch {\n\tcase err != nil:\n\t\treturn nil, fmt.Errorf(\"failed to detect CNI config file: %v\", err)\n\tcase len(files) == 0:\n\t\treturn nil, fmt.Errorf(\"no CNI network config found in %s\", confDir)\n\t}\n\n\t// files contains the network config files associated with cni network.\n\t// Use lexicographical way as a defined order for network config files.\n\tsort.Strings(files)\n\tfor _, confFile := range files {\n\t\tif strings.HasSuffix(confFile, \".conflist\") {\n\t\t\tconfList, err := cnilibrary.ConfListFromFile(confFile)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to load CNI config list file %s: %v\", confFile, err)\n\t\t\t}\n\t\t\tif confList.Name == name {\n\t\t\t\treturn &cniConfParser{\n\t\t\t\t\tlistBytes: confList.Bytes,\n\t\t\t\t}, nil\n\t\t\t}","sourceCodeStart":535,"sourceCodeEnd":571,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/allocrunner/networking_cni.go#L535-L571","documentation":"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.","triggerScenarios":"Thrown at client/allocrunner/networking_cni.go:553 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the cni_path client config points at an existing directory","Check directory permissions for the Nomad client user","Install the required .conf/.conflist/.json CNI config file"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}