hashicorp/nomad · error

fingerprint name cannot be empty

Error message

fingerprint name cannot be empty

What it means

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.

Source

Thrown at client/config/fingerprint.go:103

		result.RetryAttempts = z.RetryAttempts
	}
	if z.ExitOnFailure != nil {
		result.ExitOnFailure = z.ExitOnFailure
	}

	return &result
}

// Validate the fingerprint block to ensure we do not have any values that
// cannot be handled.
func (f *Fingerprint) Validate() error {

	if f == nil {
		return nil
	}

	if f.Name == "" {
		return errors.New("fingerprint name cannot be empty")
	}
	if !slices.Contains(validEnvFingerprinters, f.Name) {
		return fmt.Errorf("fingerprint %q does not support configuration", f.Name)
	}
	if f.RetryInterval < 0 {
		return fmt.Errorf("fingerprint %q retry interval cannot be negative", f.Name)
	}
	if f.RetryAttempts < -1 {
		return fmt.Errorf("fingerprint %q retry attempts cannot be less than -1", f.Name)
	}
	if len(f.ExtraKeysHCL) > 0 {
		return fmt.Errorf("fingerprint %q contains unknown configuration options: %s",
			f.Name, strings.Join(f.ExtraKeysHCL, ","))
	}

	return nil
}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Set Name to one of the supported values in validEnvFingerprinters before validating
  2. If no fingerprinting is wanted, use a nil config instead of an empty/unnamed one
  3. Check config parsing for a misnamed/misspelled key that leaves Name empty

Example fix

// before
f := &Fingerprint{RetryInterval: 30 * time.Second}
err := f.Validate() // fingerprint name cannot be empty
// after
f := &Fingerprint{Name: "cpu", RetryInterval: 30 * time.Second}
err := f.Validate()
Defensive patterns

Strategy: validation

Validate before calling

func validFingerprint(f *Fingerprint) bool {
    return f != nil && f.Name != "" && slices.Contains(validEnvFingerprinters, f.Name) && f.RetryInterval >= 0
}

Type guard

if f == nil { return nil } // Validate's own nil guard: nil config is allowed
if f.Name == "" { return errors.New("fingerprint name cannot be empty") }

Try / catch

if err := f.Validate(); err != nil {
    return fmt.Errorf("invalid fingerprint config: %w", err)
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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