hashicorp/nomad · error

only one attribute value may be set

Error message

only one attribute value may be set

What it means

Attribute.Validate: more than one of the Float/Int/String/Bool value fields is set on the same attribute. Exactly one value may be present.

Source

Thrown at plugins/shared/structs/attribute.go:276

	// Assert only one of the attributes is set
	set := 0
	if a.Float != nil {
		set++
	}
	if a.Int != nil {
		set++
	}
	if a.String != nil {
		set++
	}
	if a.Bool != nil {
		set++
	}

	if set == 0 {
		return fmt.Errorf("no attribute value set")
	} else if set > 1 {
		return fmt.Errorf("only one attribute value may be set")
	}

	return nil
}

// Comparable returns whether the two attributes are comparable
func (a *Attribute) Comparable(b *Attribute) bool {
	if a == nil || b == nil {
		return false
	}

	// First use the units to decide if comparison is possible
	aUnit := a.getTypedUnit()
	bUnit := b.getTypedUnit()
	if aUnit != nil && bUnit != nil {
		return aUnit.Comparable(bUnit)
	} else if aUnit != nil && bUnit == nil {
		return false

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Set only one value field on the attribute
  2. Clear the extra typed fields before validating
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at plugins/shared/structs/attribute.go:276 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/420fab1e29dd67ad. Report an issue: GitHub.