{"record":{"id":"603f9f04384ad241","repo":"temporalio/temporal","slug":"name-s-is-invalid-name-must-follow-golang-identi","errorCode":null,"errorMessage":"name %s is invalid. name must follow golang identifier rules: %s","messagePattern":"name (.+?) is invalid\\. name must follow golang identifier rules: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"chasm/registry.go","lineNumber":339,"sourceCode":"\tif !(rt.componentGoType.Kind() == reflect.Interface ||\n\t\t(rt.componentGoType.Kind() == reflect.Struct ||\n\t\t\t(rt.componentGoType.Kind() == reflect.Pointer && rt.componentGoType.Elem().Kind() == reflect.Struct)) &&\n\t\t\trt.componentGoType.AssignableTo(reflect.TypeFor[Component]())) {\n\t\treturn fmt.Errorf(\"component type %s must be and interface or struct that implements Component interface\", rt.componentGoType.String())\n\t}\n\n\tr.rtByFqn[fqn] = rt\n\tr.rtByID[id] = rt\n\tr.rtByGoType[rt.goType] = rt\n\treturn nil\n}\n\nfunc (r *Registry) validateName(n string) error {\n\tif n == \"\" {\n\t\treturn errors.New(\"name must not be empty\")\n\t}\n\tif !nameValidator.MatchString(n) {\n\t\treturn fmt.Errorf(\"name %s is invalid. name must follow golang identifier rules: %s\", n, nameValidator.String())\n\t}\n\treturn nil\n}\n\nfunc (r *Registry) validateVisibilityBusinessIDAlias(rc *RegistrableComponent) error {\n\tif !hasVisibilityField(rc.goType) {\n\t\treturn nil\n\t}\n\t// Archetypes that contain a Field[*Visibility] must specify WithBusinessIDAlias.\n\tif !rc.hasBusinessIDAlias() {\n\t\treturn fmt.Errorf(\"component %s has Field[*Visibility] but no businessID alias; use WithBusinessIDAlias option\", rc.componentType)\n\t}\n\treturn nil\n}\n\nfunc (r *Registry) warnUnmanagedFields(fqn string, rc *RegistrableComponent) {\n\tvar unmanagedFields []string\n\tfor f := range unmanagedFieldsOf(rc.goType) {","sourceCodeStart":321,"sourceCodeEnd":357,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/chasm/registry.go#L321-L357","documentation":"validateName rejects a component or task name that is empty or does not match nameValidator, a regex enforcing Go identifier rules (as reported via nameValidator.String()). Names become parts of FQNs and persisted identifiers, so they must be valid identifiers.","triggerScenarios":"Registering a component/task whose registered name contains hyphens, spaces, dots, leading digits, or other non-identifier characters; passing an empty name string.","commonSituations":"Using a kebab-case or dotted service name like \"order-cleanup\" or \"orders.v1\" as the task type; building names dynamically from config or env values with unexpected formatting; forgetting the name argument entirely (empty string).","solutions":["Rename to a valid Go identifier: letters/digits/underscores, not starting with a digit, e.g. \"order_cleanup\".","Check the regex in the error message to see exactly which characters are allowed.","If the name comes from config, sanitize/validate it before calling Register."],"exampleFix":"// before\nchasm.RegisterTask[T, C](reg, \"order-cleanup\", opts)\n// after\nchasm.RegisterTask[T, C](reg, \"order_cleanup\", opts)","handlingStrategy":"validation","validationCode":"var nameValidator = regexp.MustCompile(`^[a-zA-Z_][a-zA-Z0-9_]*$`)\nif !nameValidator.MatchString(name) {\n\treturn fmt.Errorf(\"name %q must be a valid Go identifier\", name)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use snake_case Go identifiers for component/task names — no hyphens or dots.","Validate any config/env-derived names before passing them to Register.","Never pass an empty name; require callers to supply a non-empty constant."],"tags":["chasm","registry","naming","validation"],"backgroundTag":"invalid-identifier-name","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}