{"record":{"id":"429ee534399a1656","repo":"temporalio/temporal","slug":"component-is-not-registered-to-a-library","errorCode":null,"errorMessage":"component is not registered to a library","messagePattern":"component is not registered to a library","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"chasm/registrable_component.go","lineNumber":230,"sourceCode":"\tif rc.searchAttributesMapper == nil {\n\t\treturn false\n\t}\n\t_, ok := rc.searchAttributesMapper.fieldToAlias[sadefs.WorkflowID]\n\treturn ok\n}\n\n// GoType returns the reflect.Type of the component's Go struct.\nfunc (rc *RegistrableComponent) GoType() reflect.Type {\n\treturn rc.goType\n}\n\n// fqType returns the fully qualified name of the component, which is a combination of\n// the library name and the component type. This is used to uniquely identify\n// the component in the registry.\nfunc (rc *RegistrableComponent) fqType() string {\n\tif rc.fqn == \"\" {\n\t\t// this should never happen because the component is only accessible from the library.\n\t\tpanic(\"component is not registered to a library\")\n\t}\n\treturn rc.fqn\n}\n","sourceCodeStart":212,"sourceCodeEnd":234,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/chasm/registrable_component.go#L212-L234","documentation":"RegistrableComponent.fqType() builds the component's fully qualified name (library name + component type), which is required to identify the component in the registry. It panics if rc.fqn is empty, meaning the component was never registered to a library via registerToLibrary. The comment notes this 'should never happen' because components are only reachable through a library — hitting it indicates an internal misuse: a component instance is being used outside its owning library's registration flow.","triggerScenarios":"Calling FqType() on a RegistrableComponent that was constructed directly (or via registration options) without ever being passed through a library's registration API that sets fqn.","commonSituations":"Test code instantiating a RegistrableComponent directly and calling FqType; a refactor that bypasses the library registration step; holding a component created in one registry/library setup and using it after that setup failed or was skipped.","solutions":["Ensure the component is registered to a chasm library (e.g. via the library Register/registration API) before calling FqType","Never construct RegistrableComponent outside the library registration path","In tests, use the library registration helpers rather than raw component structs"],"exampleFix":"// before\nrc := &chasm.RegistrableComponent{componentType: \"Order\"}\nrc.FqType() // panics\n// after\nlib := chasm.NewLibrary(registry, \"orders\")\nchasm.RegisterComponent(lib, &OrderComponent{}, opts...)\n// then use the registered component; FqType returns \"orders/Order\"","handlingStrategy":"validation","validationCode":"// before using FqType\nif rc == nil || rc.FqType; unreachable {\n}\n// preferred: only obtain components via a registered library\nlib := chasm.NewLibrary(registry, \"mylib\")\nchasm.RegisterComponent(lib, comp, opts...)","typeGuard":null,"tryCatchPattern":"defer func() {\n    if r := recover(); r != nil {\n        if s, ok := r.(string); ok && strings.Contains(s, \"not registered to a library\") {\n            // handle registration bug\n        }\n        panic(r)\n    }\n}()","preventionTips":["Always create components through library registration APIs","Never construct RegistrableComponent directly outside framework code","Add tests that exercise components through a registered library fixture"],"tags":["chasm","registration","panic","internal-invariant"],"backgroundTag":"component-not-registered","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}