{"record":{"id":"58e413d49ca1df9c","repo":"temporalio/temporal","slug":"w-s","errorCode":null,"errorMessage":"%w: %s","messagePattern":"%w: %s","errorType":"exception","errorClass":"sadefs.ErrInvalidName","httpStatus":null,"severity":"error","filePath":"common/searchattribute/name_type_map.go","lineNumber":164,"sourceCode":"func (m NameTypeMap) getType(name string, cat category) (enumspb.IndexedValueType, error) {\n\tif cat|customCategory == cat && len(m.customSearchAttributes) != 0 {\n\t\tif t, isCustom := m.customSearchAttributes[name]; isCustom {\n\t\t\treturn t, nil\n\t\t}\n\t}\n\tif cat|predefinedCategory == cat {\n\t\tpredefinedSearchAttributes := m.predefined()\n\t\tif t, isPredefined := predefinedSearchAttributes[name]; isPredefined {\n\t\t\treturn t, nil\n\t\t}\n\t}\n\tif cat|systemCategory == cat {\n\t\tsystemSearchAttributes := m.system()\n\t\tif t, isSystem := systemSearchAttributes[name]; isSystem {\n\t\t\treturn t, nil\n\t\t}\n\t}\n\treturn enumspb.INDEXED_VALUE_TYPE_UNSPECIFIED, fmt.Errorf(\"%w: %s\", sadefs.ErrInvalidName, name)\n}\n\nfunc (m NameTypeMap) IsDefined(name string) bool {\n\tif _, err := m.GetType(name); err == nil {\n\t\treturn true\n\t}\n\treturn false\n}\n\n// MergeNameTypeMaps merges two NameTypeMap. The first NameTypeMap is used as base, and the second\n// NameTypeMap is added to the first map, ie., in case of conflicts, elements from the second map\n// overwrites elements from the first map.\nfunc MergeNameTypeMaps(a NameTypeMap, b NameTypeMap) NameTypeMap {\n\tres := NameTypeMap{\n\t\tsystemSearchAttributes:     make(map[string]enumspb.IndexedValueType),\n\t\tpredefinedSearchAttributes: make(map[string]enumspb.IndexedValueType),\n\t\tcustomSearchAttributes:     make(map[string]enumspb.IndexedValueType),\n\t}","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/common/searchattribute/name_type_map.go#L146-L182","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check the name for typos and confirm it is registered in the namespace's search attributes.","If using a search-attribute mapper, add the name to the customSearchAttributes dynamic-config map and redeploy/restart workers.","Use NameTypeMap.IsDefined (which calls GetType) to check existence before encoding/decoding."],"exampleFix":"// before\nnameType, err := saProvider.GetType(nil, \"QueuName\") // misspelled\n// after\nif saProvider.IsDefined(nil, \"QueueName\") {\n    nameType, err = saProvider.GetType(nil, \"QueueName\")\n}","handlingStrategy":"validation","validationCode":"if !nameTypeMap.IsDefined(name) {\n    return fmt.Errorf(\"search attribute %q is not registered\", name)\n}","typeGuard":null,"tryCatchPattern":"var errInvalid *sadefs.InvalidNameError\nif errors.As(err, &errInvalid) { /* fall back to default type or skip attribute */ }","preventionTips":["Keep the customSearchAttributes dynamic-config mapper in sync with attributes used by workers","Call IsDefined before encode/decode on user-supplied names","Centralize attribute name constants instead of string literals"],"tags":["go","search-attributes","invalid-name"],"backgroundTag":"unknown-search-attribute-name","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}