{"record":{"id":"67b4e7b867ec2a0a","repo":"hashicorp/nomad","slug":"failed-to-load-cni-config-list-file-s-v-67b4e7","errorCode":null,"errorMessage":"failed to load CNI config list file %s: %v","messagePattern":"failed to load CNI config list file (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/fingerprint/cni.go","lineNumber":45,"sourceCode":"func (f *CNIFingerprint) Fingerprint(req *FingerprintRequest, resp *FingerprintResponse) error {\n\tconfDir := req.Config.CNIConfigDir\n\tnetworks := map[string]struct{}{}\n\tif _, err := os.Stat(confDir); os.IsNotExist(err) {\n\t\tf.logger.Debug(\"CNI config dir is not set or does not exist, skipping\", \"cni_config_dir\", confDir)\n\t\tresp.Detected = false\n\t\treturn nil\n\t}\n\n\tfiles, err := libcni.ConfFiles(confDir, []string{\".conf\", \".conflist\", \".json\"})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to detect CNI conf files: %v\", err)\n\t}\n\n\tfor _, confFile := range files {\n\t\tif strings.HasSuffix(confFile, \".conflist\") {\n\t\t\tconfList, err := libcni.ConfListFromFile(confFile)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to load CNI config list file %s: %v\", confFile, err)\n\t\t\t}\n\t\t\tif _, ok := networks[confList.Name]; ok {\n\t\t\t\tf.logger.Warn(\"duplicate CNI config names found, ignoring file\", \"name\", confList.Name, \"file\", confFile)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tnetworks[confList.Name] = struct{}{}\n\t\t} else {\n\t\t\tconf, err := libcni.ConfFromFile(confFile)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to load CNI config file %s: %v\", confFile, err)\n\t\t\t}\n\t\t\tif _, ok := networks[conf.Network.Name]; ok {\n\t\t\t\tf.logger.Warn(\"duplicate CNI config names found, ignoring file\", \"name\", conf.Network.Name, \"file\", confFile)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tnetworks[conf.Network.Name] = struct{}{}\n\t\t}\n\t}","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/fingerprint/cni.go#L27-L63","documentation":"Nomad's CNI fingerprinter scans the CNI config directory (default /opt/cni/net.d) for network configurations. When it encounters a *.conflist file it calls libcni.ConfListFromFile to parse it; if the file cannot be read or parsed as a valid CNI conflist JSON, the fingerprint aborts with this wrapped error.","triggerScenarios":"A .conflist file exists in the CNI conf dir but is malformed JSON, missing required fields (name/plugins), unreadable due to permissions, or is a dangling symlink/broken file.","commonSituations":"Partially written or truncated conflist after a failed CNI plugin install; hand-edited conflist with JSON syntax errors; wrong file ownership after Ansible/automation deployment; node upgraded and old plugin config incompatible.","solutions":["Validate the JSON of the failing .conflist file (jq . <file>) and fix syntax/missing fields","Check file permissions so the Nomad agent user can read the file","Remove or rename the broken .conflist if the plugin is no longer used","Confirm the cni_config_dir client config points at the directory actually populated by your CNI plugins","Reinstall the CNI plugin package to regenerate correct conflist files"],"exampleFix":"// before (broken conflist)\n{\"name\":\"mynet\",\"cniVersion\":\"0.4.0\"} // missing \"plugins\"\n// after\n{\"name\":\"mynet\",\"cniVersion\":\"0.4.0\",\"plugins\":[{\"type\":\"bridge\",\"bridge\":\"cni0\"}]}","handlingStrategy":"validation","validationCode":"for _, f := range cniFiles { if strings.HasSuffix(f, \".conflist\") { if _, err := os.Stat(f); err != nil { return err }; b, err := os.ReadFile(f); if err != nil { return err }; var cl struct{ Name string `json:\"name\"`; Plugins []json.RawMessage `json:\"plugins\"` }; if err := json.Unmarshal(b, &cl); err != nil || cl.Name == \"\" || len(cl.Plugins) == 0 { return fmt.Errorf(\"invalid conflist %s\", f) } } }","typeGuard":"func isValidConflist(path string) bool { b, err := os.ReadFile(path); if err != nil { return false }; var cl struct{ Name string `json:\"name\"`; Plugins []json.RawMessage `json:\"plugins\"` }; return json.Unmarshal(b, &cl) == nil && cl.Name != \"\" && len(cl.Plugins) > 0 }","tryCatchPattern":null,"preventionTips":["Validate all files in the CNI conf dir with jq before agent startup","Exclude backup/tmp files from the CNI conf directory","Automate CNI plugin installs atomically (write temp file, rename)","Set correct ownership/permissions in your provisioning tooling"],"tags":["cni","networking","file-parse"],"backgroundTag":"cni-config-parse-failure","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"}