temporalio/temporal · error
unknown index value type %v
Error message
unknown index value type %v
What it means
SetMetadataType stamps the IndexedValueType into a Payload's search-attribute metadata. It panics when the passed type t is not a valid enumspb.IndexedValueType value (no name registered in the enum), because an unknown type cannot be serialized into metadata.
Source
Thrown at common/searchattribute/sadefs/util.go:30
)
func GetMetadataType(p *commonpb.Payload) enumspb.IndexedValueType {
t, err := enumspb.IndexedValueTypeFromString(string(p.Metadata[MetadataType]))
if err != nil {
return enumspb.INDEXED_VALUE_TYPE_UNSPECIFIED
}
return t
}
func SetMetadataType(p *commonpb.Payload, t enumspb.IndexedValueType) {
if t == enumspb.INDEXED_VALUE_TYPE_UNSPECIFIED {
return
}
_, isValidT := enumspb.IndexedValueType_name[int32(t)]
if !isValidT {
// nolint: forbidigo
panic(fmt.Sprintf("unknown index value type %v", t))
}
p.Metadata[MetadataType] = []byte(t.String())
}
View on GitHub (pinned to bde624efd1)
Solutions
- Pass only valid enumspb.IndexedValueType values (check enumspb.IndexedValueType_name)
- Fix the type map / conversion code that produces the invalid type value
- Upgrade the binary so the newer enum value is recognized
Example fix
// before
t := enumspb.IndexedValueType(rawTypeID) // may be undefined
sadefs.SetMetadataType(payload, t)
// after
if _, ok := enumspb.IndexedValueType_name[int32(rawTypeID)]; !ok {
return fmt.Errorf("unknown indexed value type %d", rawTypeID)
}
sadefs.SetMetadataType(payload, enumspb.IndexedValueType(rawTypeID)) Defensive patterns
Strategy: validation
Validate before calling
if _, ok := enumspb.IndexedValueType_name[int32(t)]; !ok {
return fmt.Errorf("unknown indexed value type %d", int32(t))
}
sadefs.SetMetadataType(payload, t) Try / catch
func() (err error) {
defer func() {
if r := recover(); r != nil { err = fmt.Errorf("set metadata type: %v", r) }
}()
sadefs.SetMetadataType(payload, t)
return nil
}() Prevention
- Never cast raw ints to enumspb.IndexedValueType without validating against IndexedValueType_name
- Synchronize proto enum versions across services
- Validate type maps before ApplyTypeMap
When it happens
Trigger: Calling SetMetadataType (directly or via Encode/EncodeValue/ApplyTypeMap) with an out-of-range or undefined IndexedValueType — e.g. IndexedValueType(99) cast from an int, or a type from a newer proto not known to this binary.
Common situations: Converting custom/legacy type IDs to IndexedValueType via int casts; version skew with newer enum values; corrupt type maps passed to ApplyTypeMap.
Related errors
AI-assisted analysis of temporalio/temporal@bde624efd1 (2026-09-01).
Data as JSON: /api/errors/7fc2bdba3a320665.
Report an issue: GitHub.