temporalio/temporal · error · sadefs.ErrInvalidName

%w: %s

Error message

%w: %s

What it means

NameTypeMap.GetType returns this error (wrapping sadefs.ErrInvalidName) when the given search attribute name is not present in the map (neither in system nor custom attributes). Encode, Decode, GetType, ApplyTypeMap, Stringify, and Parse all funnel through getType, so any operation referencing an attribute name the mapper does not know about fails here. It signals that the name was never registered (e.g. via a search attribute mapper from deployment config) or is simply misspelled.

Source

Thrown at common/searchattribute/name_type_map.go:164

func (m NameTypeMap) getType(name string, cat category) (enumspb.IndexedValueType, error) {
	if cat|customCategory == cat && len(m.customSearchAttributes) != 0 {
		if t, isCustom := m.customSearchAttributes[name]; isCustom {
			return t, nil
		}
	}
	if cat|predefinedCategory == cat {
		predefinedSearchAttributes := m.predefined()
		if t, isPredefined := predefinedSearchAttributes[name]; isPredefined {
			return t, nil
		}
	}
	if cat|systemCategory == cat {
		systemSearchAttributes := m.system()
		if t, isSystem := systemSearchAttributes[name]; isSystem {
			return t, nil
		}
	}
	return enumspb.INDEXED_VALUE_TYPE_UNSPECIFIED, fmt.Errorf("%w: %s", sadefs.ErrInvalidName, name)
}

func (m NameTypeMap) IsDefined(name string) bool {
	if _, err := m.GetType(name); err == nil {
		return true
	}
	return false
}

// MergeNameTypeMaps merges two NameTypeMap. The first NameTypeMap is used as base, and the second
// NameTypeMap is added to the first map, ie., in case of conflicts, elements from the second map
// overwrites elements from the first map.
func MergeNameTypeMaps(a NameTypeMap, b NameTypeMap) NameTypeMap {
	res := NameTypeMap{
		systemSearchAttributes:     make(map[string]enumspb.IndexedValueType),
		predefinedSearchAttributes: make(map[string]enumspb.IndexedValueType),
		customSearchAttributes:     make(map[string]enumspb.IndexedValueType),
	}

View on GitHub (pinned to bde624efd1)

Solutions

  1. Check the name for typos and confirm it is registered in the namespace's search attributes.
  2. If using a search-attribute mapper, add the name to the customSearchAttributes dynamic-config map and redeploy/restart workers.
  3. Use NameTypeMap.IsDefined (which calls GetType) to check existence before encoding/decoding.

Example fix

// before
nameType, err := saProvider.GetType(nil, "QueuName") // misspelled
// after
if saProvider.IsDefined(nil, "QueueName") {
    nameType, err = saProvider.GetType(nil, "QueueName")
}
Defensive patterns

Strategy: validation

Validate before calling

if !nameTypeMap.IsDefined(name) {
    return fmt.Errorf("search attribute %q is not registered", name)
}

Try / catch

var errInvalid *sadefs.InvalidNameError
if errors.As(err, &errInvalid) { /* fall back to default type or skip attribute */ }

Prevention

When it happens

Trigger: Calling GetType/Encode/Decode/Stringify/Parse with a search attribute name that is absent from the NameTypeMap, e.g. an unregistered custom attribute or a name removed from the search-attribute mapper config while old workflows still reference it.

Common situations: Custom search attributes defined on the namespace but missing from the cluster's SearchAttributes mapper in dynamic config; typo in attribute name; attribute type renamed in sadefs after a version upgrade so old code references a stale name.

Related errors


AI-assisted analysis of temporalio/temporal@bde624efd1 (2026-09-01). Data as JSON: /api/errors/58e413d49ca1df9c. Report an issue: GitHub.