{"record":{"id":"1e0f90baea9dec21","repo":"temporalio/temporal","slug":"chasm-visibilitytaskhandler-should-not-be-called-d","errorCode":null,"errorMessage":"chasm visibilityTaskHandler should not be called directly","messagePattern":"chasm visibilityTaskHandler should not be called directly","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"chasm/visibility.go","lineNumber":408,"sourceCode":"var defaultVisibilityTaskHandler = &visibilityTaskHandler{}\n\nfunc (v *visibilityTaskHandler) Validate(\n\t_ Context,\n\tcomponent *Visibility,\n\t_ TaskInvocation,\n\ttask *persistencespb.ChasmVisibilityTaskData,\n) (bool, error) {\n\treturn task.TransitionCount == component.Data.TransitionCount, nil\n}\n\nfunc (v *visibilityTaskHandler) Execute(\n\t_ context.Context,\n\t_ ComponentRef,\n\t_ TaskAttributes,\n\t_ *persistencespb.ChasmVisibilityTaskData,\n) error {\n\t//nolint:forbidigo\n\tpanic(\"chasm visibilityTaskHandler should not be called directly\")\n}\n","sourceCodeStart":390,"sourceCodeEnd":410,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/chasm/visibility.go#L390-L410","documentation":"visibilityTaskHandler in chasm/visibility.go panics if its Execute method is invoked directly. Visibility tasks in CHASM must be dispatched through the framework's task processing pipeline (which routes them to the component-specific handler with the correct context), never called as a plain method. The panic is a guard against a programming error that would bypass framework invariants.","triggerScenarios":"Calling visibilityTaskHandler.Execute(ctx, ref, attrs, taskData) directly from application code instead of registering it with the CHASM framework and letting the task processor invoke it.","commonSituations":"Custom task scheduling code that grabs a handler and calls Execute manually; refactoring that wires visibility tasks outside the CHASM processing loop; tests invoking the handler directly without a framework harness.","solutions":["Do not call visibilityTaskHandler.Execute directly; let the CHASM task framework dispatch visibility tasks","Register the handler with the CHASM framework/task registry and process tasks through the standard pipeline","If you need to drive it in tests, exercise the framework's task processing path rather than the raw method"],"exampleFix":"// before\nhandler := chasm.NewVisibilityTaskHandler(...)\nerr := handler.Execute(ctx, ref, attrs, taskData)\n// after\nerr := chasmTaskProcessor.Process(ctx, task) // framework dispatches to the handler\n","handlingStrategy":"validation","validationCode":"var _ chasm.TaskHandler = (*visibilityTaskHandler)(nil)\n// never invoke Execute directly; verify dispatch goes through the task processor","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat all chasm task handlers as framework-internal interfaces","Process visibility tasks only via the CHASM task processor/registry","In tests, drive the framework's processing loop rather than calling handler methods"],"tags":["chasm","visibility","panic","misuse-guard"],"backgroundTag":"handler-called-directly","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}