{"record":{"id":"f2ba43634759a452","repo":"temporalio/temporal","slug":"invalid-number-of-custom-search-attributes-for-typ","errorCode":null,"errorMessage":"invalid number of custom search attributes for type %s (must be between 0 and 99)","messagePattern":"invalid number of custom search attributes for type (.+?) \\(must be between 0 and 99\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"temporal/fx.go","lineNumber":697,"sourceCode":"\n\tclusterMetadataManager, err := factory.NewClusterMetadataManager()\n\tif err != nil {\n\t\treturn svc.ClusterMetadata, svc.Persistence, fmt.Errorf(\"error initializing cluster metadata manager: %w\", err)\n\t}\n\tdefer clusterMetadataManager.Close()\n\n\tvisCSAOverride := map[enumspb.IndexedValueType]int{}\n\tfor tpName, value := range svc.Visibility.PersistenceCustomSearchAttributes {\n\t\tsaType, ok := enumspb.IndexedValueType_shorthandValue[tpName]\n\t\tif !ok {\n\t\t\treturn svc.ClusterMetadata,\n\t\t\t\tsvc.Persistence,\n\t\t\t\tfmt.Errorf(\"invalid search attribute type: %s\", tpName)\n\t\t}\n\t\tif value < 0 || value > 99 {\n\t\t\treturn svc.ClusterMetadata,\n\t\t\t\tsvc.Persistence,\n\t\t\t\tfmt.Errorf(\n\t\t\t\t\t\"invalid number of custom search attributes for type %s (must be between 0 and 99)\",\n\t\t\t\t\ttpName,\n\t\t\t\t)\n\t\t}\n\t\tvisCSAOverride[enumspb.IndexedValueType(saType)] = value\n\t}\n\n\tvisDataStores := []config.DataStore{\n\t\tsvc.Persistence.GetVisibilityStoreConfig(),\n\t\tsvc.Persistence.GetSecondaryVisibilityStoreConfig(),\n\t}\n\tindexSearchAttributes := make(map[string]*persistencespb.IndexSearchAttributes)\n\tfor _, ds := range visDataStores {\n\t\tindexSearchAttributes[ds.GetIndexName()] = sadefs.GetDBIndexSearchAttributes(visCSAOverride)\n\t}\n\n\tclusterMetadata := svc.ClusterMetadata\n\tif len(clusterMetadata.ClusterInformation) > 1 {","sourceCodeStart":679,"sourceCodeEnd":715,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/temporal/fx.go#L679-L715","documentation":"Validation error when a PersistenceCustomSearchAttributes value (the configured limit of custom search attributes for that type) is negative or exceeds 99. Temporal caps custom search attributes per type at 99 to fit persistence limits.","triggerScenarios":"Setting a negative number or a number > 99 as the value for an entry in Visibility.PersistenceCustomSearchAttributes.","commonSituations":"Operator raising the CSA budget to e.g. 1000 not knowing the hard cap; copy-paste from docs with different limits; sign typo (-1) in YAML.","solutions":["Set the value between 0 and 99 inclusive","If more CSAs are needed, plan migration within the 99 limit","Validate config before startup"],"exampleFix":"// before\nvisibility:\n  persistenceCustomSearchAttributes:\n    CustomIntField: 1000\n// after\nvisibility:\n  persistenceCustomSearchAttributes:\n    CustomIntField: 50","handlingStrategy":"validation","validationCode":"for name, n := range cfg.Visibility.PersistenceCustomSearchAttributes {\n    if n < 0 || n > 99 {\n        return fmt.Errorf(\"CSA limit for %s must be 0-99, got %d\", name, n)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember the hard 99-per-type cap when planning CSA budgets","Validate numeric ranges in config CI checks","Avoid negative sentinel values in YAML"],"tags":["config","search-attributes","validation"],"backgroundTag":"invalid-search-attribute-type","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}