{"record":{"id":"792ef2f824095f6e","repo":"temporalio/temporal","slug":"task-is-not-registered-to-a-library","errorCode":null,"errorMessage":"task is not registered to a library","messagePattern":"task is not registered to a library","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"chasm/registrable_task.go","lineNumber":195,"sourceCode":"}\n\n// TaskGroup returns the side-effect task group for the task.\nfunc (rt *RegistrableTask) TaskGroup() string {\n\treturn rt.outboundTaskGroup\n}\n\n// GoType returns the reflect.Type of the task's Go struct.\nfunc (rt *RegistrableTask) GoType() reflect.Type {\n\treturn rt.goType\n}\n\n// fqType returns the fully qualified name of the task, which is a combination of\n// the library name and the task type. This is used to uniquely identify\n// the task in the registry.\nfunc (rt *RegistrableTask) fqType() string {\n\tif rt.library == nil {\n\t\t// this should never happen because the task is only accessible from the library.\n\t\tpanic(\"task is not registered to a library\")\n\t}\n\treturn FullyQualifiedName(rt.library.Name(), rt.taskType)\n}\n\n// WithTaskGroup sets the task group for the task. The task group is used when\n// the side effect's destination is specified for grouping semantics on the outbound queue,\n// affects multi-cursor and the circuit breaker.\n// If task group isn't provided, the task group will default to the fully qualified name at library registration.\nfunc WithTaskGroup(taskgroup string) RegistrableTaskOption {\n\treturn func(rt *RegistrableTask) {\n\t\trt.outboundTaskGroup = taskgroup\n\t}\n}\n\n// WithSingletonTask configures the task type as a singleton: at most one task of this type\n// may exist per component instance at any time. The mode controls what happens when a new\n// task is added while one already exists:\n//   - [SingletonTaskModeReplace]: the existing task is removed and the new one takes its place.","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/chasm/registrable_task.go#L177-L213","documentation":"RegistrableTask.fqType() builds the task's fully qualified name from its library's name plus the task type, needed to uniquely identify the task in the registry. It panics when rt.library is nil, i.e. the task was never registered to a library. Like the component variant, this guards an internal invariant: tasks are only expected to be reachable through their owning library.","triggerScenarios":"Calling FqType() (or otherwise triggering fqType) on a RegistrableTask created outside a library registration; also reachable from registerToLibrary flows if the task's library reference was never set before use.","commonSituations":"Directly constructing a RegistrableTask in tests or tooling; a refactor that detached task registration from library registration; using a task defined in a library whose registration failed earlier.","solutions":["Register the task to a chasm library before use (via the library's task registration API)","Don't construct RegistrableTask values directly; go through the library registration helpers","Fix test setup so tasks are registered in a library fixture"],"exampleFix":"// before\ntask := &chasm.RegistrableTask{taskType: \"SideEffect\"}\ntask.FqType() // panics\n// after\nlib := chasm.NewLibrary(registry, \"orders\")\nchasm.RegisterTask(lib, &OrderSideEffectTask{})\n// FqType returns \"orders/SideEffect\"","handlingStrategy":"validation","validationCode":"// register tasks via a library before use\nlib := chasm.NewLibrary(registry, \"mylib\")\nchasm.RegisterTask(lib, task) // sets library reference","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":["Register every task type through its library's registration API","Avoid raw RegistrableTask construction in tests/tooling","Use library fixtures in tests so tasks always have a library"],"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-08T15:18:49.778Z"}