temporalio/temporal · error
chasm visibilityTaskHandler should not be called directly
Error message
chasm visibilityTaskHandler should not be called directly
What it means
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.
Source
Thrown at chasm/visibility.go:408
var defaultVisibilityTaskHandler = &visibilityTaskHandler{}
func (v *visibilityTaskHandler) Validate(
_ Context,
component *Visibility,
_ TaskInvocation,
task *persistencespb.ChasmVisibilityTaskData,
) (bool, error) {
return task.TransitionCount == component.Data.TransitionCount, nil
}
func (v *visibilityTaskHandler) Execute(
_ context.Context,
_ ComponentRef,
_ TaskAttributes,
_ *persistencespb.ChasmVisibilityTaskData,
) error {
//nolint:forbidigo
panic("chasm visibilityTaskHandler should not be called directly")
}
View on GitHub (pinned to bde624efd1)
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
Example fix
// before handler := chasm.NewVisibilityTaskHandler(...) err := handler.Execute(ctx, ref, attrs, taskData) // after err := chasmTaskProcessor.Process(ctx, task) // framework dispatches to the handler
Defensive patterns
Strategy: validation
Validate before calling
var _ chasm.TaskHandler = (*visibilityTaskHandler)(nil) // never invoke Execute directly; verify dispatch goes through the task processor
Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- component %s has Field[*Visibility] but no businessID alias;
- unable to insert chasm search attributes: %w
- unable to upsert chasm search attributes: %w
- registrable component validation error: CHASM search attribu
- registrable component validation error: CHASM search attribu
AI-assisted analysis of temporalio/temporal@bde624efd1 (2026-09-01).
Data as JSON: /api/errors/1e0f90baea9dec21.
Report an issue: GitHub.