{"record":{"id":"0e6fedc960a2a6e2","repo":"hashicorp/nomad","slug":"fingerprint-name-cannot-be-empty","errorCode":null,"errorMessage":"fingerprint name cannot be empty","messagePattern":"fingerprint name cannot be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/config/fingerprint.go","lineNumber":103,"sourceCode":"\t\tresult.RetryAttempts = z.RetryAttempts\n\t}\n\tif z.ExitOnFailure != nil {\n\t\tresult.ExitOnFailure = z.ExitOnFailure\n\t}\n\n\treturn &result\n}\n\n// Validate the fingerprint block to ensure we do not have any values that\n// cannot be handled.\nfunc (f *Fingerprint) Validate() error {\n\n\tif f == nil {\n\t\treturn nil\n\t}\n\n\tif f.Name == \"\" {\n\t\treturn errors.New(\"fingerprint name cannot be empty\")\n\t}\n\tif !slices.Contains(validEnvFingerprinters, f.Name) {\n\t\treturn fmt.Errorf(\"fingerprint %q does not support configuration\", f.Name)\n\t}\n\tif f.RetryInterval < 0 {\n\t\treturn fmt.Errorf(\"fingerprint %q retry interval cannot be negative\", f.Name)\n\t}\n\tif f.RetryAttempts < -1 {\n\t\treturn fmt.Errorf(\"fingerprint %q retry attempts cannot be less than -1\", f.Name)\n\t}\n\tif len(f.ExtraKeysHCL) > 0 {\n\t\treturn fmt.Errorf(\"fingerprint %q contains unknown configuration options: %s\",\n\t\t\tf.Name, strings.Join(f.ExtraKeysHCL, \",\"))\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/config/fingerprint.go#L85-L121","documentation":"FingerprintConfig.Validate() rejects a fingerprint configuration whose Name is empty. The name selects which built-in environment fingerprinter is being configured, and an empty name cannot be matched against validEnvFingerprinters. The method returns nil early if the whole config is nil, so this error only fires on a non-nil config with a blank Name.","triggerScenarios":"Calling Validate() on a non-nil Fingerprint (f) where f.Name == \"\", e.g. a fingerprint stanza in config that omitted the name field, or code constructing Fingerprint{} without setting Name.","commonSituations":"Typo in the config key holding the fingerprinter name so it decodes to empty; building fingerprint options programmatically and forgetting Name; copying a config template with a placeholder left blank.","solutions":["Set Name to one of the supported values in validEnvFingerprinters before validating","If no fingerprinting is wanted, use a nil config instead of an empty/unnamed one","Check config parsing for a misnamed/misspelled key that leaves Name empty"],"exampleFix":"// before\nf := &Fingerprint{RetryInterval: 30 * time.Second}\nerr := f.Validate() // fingerprint name cannot be empty\n// after\nf := &Fingerprint{Name: \"cpu\", RetryInterval: 30 * time.Second}\nerr := f.Validate()","handlingStrategy":"validation","validationCode":"func validFingerprint(f *Fingerprint) bool {\n    return f != nil && f.Name != \"\" && slices.Contains(validEnvFingerprinters, f.Name) && f.RetryInterval >= 0\n}","typeGuard":"if f == nil { return nil } // Validate's own nil guard: nil config is allowed\nif f.Name == \"\" { return errors.New(\"fingerprint name cannot be empty\") }","tryCatchPattern":"if err := f.Validate(); err != nil {\n    return fmt.Errorf(\"invalid fingerprint config: %w\", err)\n}","preventionTips":["Set Name to a supported fingerprinter listed in validEnvFingerprinters","Prefer nil config (disables) over empty structs","Lint config files for fingerprint stanzas missing the name field","Keep RetryInterval >= 0 to pass the adjacent check"],"tags":["config","validation","fingerprint"],"backgroundTag":"invalid-config-validation","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"}