{"record":{"id":"f54b18e24a6f1db4","repo":"temporalio/temporal","slug":"registrable-component-validation-error-chasm-sear-f54b18","errorCode":null,"errorMessage":"registrable component validation error: CHASM search attribute alias %q is already defined as a system search attribute alias","messagePattern":"registrable component validation error: CHASM search attribute alias %q is already defined as a system search attribute alias","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"chasm/registrable_component.go","lineNumber":145,"sourceCode":"\t\t\t\t\t//nolint:forbidigo\n\t\t\t\t\tpanic(fmt.Sprintf(\"registrable component validation error: system search attribute override %q is already defined\", field))\n\t\t\t\t}\n\t\t\t\trc.searchAttributesMapper.overriddenSystemFields[field] = valueType\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif sadefs.IsChasmSystem(alias) {\n\t\t\t\t//nolint:forbidigo\n\t\t\t\tpanic(fmt.Sprintf(\"registrable component validation error: CHASM search attribute alias %q is a CHASM system search attribute\", alias))\n\t\t\t}\n\t\t\tif !sadefs.IsSystem(alias) && sadefs.IsReserved(alias) {\n\t\t\t\t//nolint:forbidigo\n\t\t\t\tpanic(fmt.Sprintf(\"registrable component validation error: CHASM search attribute alias %q is a reserved search attribute\", alias))\n\t\t\t}\n\n\t\t\tif _, ok := rc.searchAttributesMapper.systemAliasToField[alias]; ok {\n\t\t\t\t//nolint:forbidigo\n\t\t\t\tpanic(fmt.Sprintf(\"registrable component validation error: CHASM search attribute alias %q is already defined as a system search attribute alias\", alias))\n\t\t\t}\n\t\t\tif _, ok := rc.searchAttributesMapper.aliasToField[alias]; ok {\n\t\t\t\t//nolint:forbidigo\n\t\t\t\tpanic(fmt.Sprintf(\"registrable component validation error: search attribute alias %q is already defined\", alias))\n\t\t\t}\n\t\t\tif _, ok := rc.searchAttributesMapper.fieldToAlias[field]; ok {\n\t\t\t\t//nolint:forbidigo\n\t\t\t\tpanic(fmt.Sprintf(\"registrable component validation error: search attribute field %q is already defined\", field))\n\t\t\t}\n\n\t\t\trc.searchAttributesMapper.aliasToField[alias] = field\n\t\t\trc.searchAttributesMapper.fieldToAlias[field] = alias\n\t\t\trc.searchAttributesMapper.saTypeMap[field] = valueType\n\t\t}\n\t}\n}\n\n// WithContextValues allows specifying key-value pairs that will be available in the Context","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/chasm/registrable_component.go#L127-L163","documentation":"This panic fires when a CHASM component's WithSearchAttributes option defines an alias that already maps to a system search attribute (alias is present in systemAliasToField, e.g. previously bound via the business-ID/system alias registration paths). Allowing it would make alias resolution ambiguous between the system column mapping and the custom mapping, so registration fails fast with a panic.","triggerScenarios":"Calling chasm.WithSearchAttributes with a SearchAttribute whose alias was already registered as a system alias on the same RegistrableComponent (e.g. reusing the business ID alias or a system alias set up by WithBusinessID or prior options).","commonSituations":"Defining a custom search attribute with the same alias as a system-registered attribute (like the business ID alias) in the same component; combining two option functions that both reference the same alias; copy-pasting option lists between components.","solutions":["Pick a distinct alias for the custom search attribute","Audit all RegistrableComponentOption calls on the component for overlapping aliases","If you want to query the system field, reference the system attribute directly instead of redeclaring it"],"exampleFix":"// before\nchasm.WithBusinessID(\"WorkflowID\"),\nchasm.WithSearchAttributes(chasm.NewSearchAttribute(\"WorkflowID\", ...)) // duplicate\n// after\nchasm.WithBusinessID(\"WorkflowID\"),\nchasm.WithSearchAttributes(chasm.NewSearchAttribute(\"OrderID\", ...))","handlingStrategy":"validation","validationCode":"// ensure the alias isn't a system-registered alias before registering\nif _, ok := mapper.SystemAliasToField[alias]; ok {\n    return fmt.Errorf(\"alias %q is a system alias\", alias)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never reuse system/business ID alias names for custom attributes","Keep all WithSearchAttributes options for a component in one file to spot overlaps","Run a startup-time registration test covering every component"],"tags":["chasm","search-attributes","registration","duplicate","panic"],"backgroundTag":"duplicate-search-attribute-alias","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}