{"record":{"id":"5f8d857277ac0adf","repo":"temporalio/temporal","slug":"errinvalidworkflowtasktimeoutseconds","errorCode":"errInvalidWorkflowTaskTimeoutSeconds","errorMessage":"%w cause: %v","messagePattern":"%w cause: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"chasm/lib/workflow/validator.go","lineNumber":81,"sourceCode":"type StartWorkflowTimeoutLikeRequest interface {\n\tGetWorkflowExecutionTimeout() *durationpb.Duration\n\tGetWorkflowRunTimeout() *durationpb.Duration\n\tGetWorkflowTaskTimeout() *durationpb.Duration\n}\n\nfunc (v *RequestValidator) ValidateWorkflowTimeouts(\n\trequest StartWorkflowTimeoutLikeRequest,\n) error {\n\tif err := timestamp.ValidateAndCapProtoDuration(request.GetWorkflowExecutionTimeout()); err != nil {\n\t\treturn fmt.Errorf(\"%w cause: %v\", errInvalidWorkflowExecutionTimeoutSeconds, err)\n\t}\n\n\tif err := timestamp.ValidateAndCapProtoDuration(request.GetWorkflowRunTimeout()); err != nil {\n\t\treturn fmt.Errorf(\"%w cause: %v\", errInvalidWorkflowRunTimeoutSeconds, err)\n\t}\n\n\tif err := timestamp.ValidateAndCapProtoDuration(request.GetWorkflowTaskTimeout()); err != nil {\n\t\treturn fmt.Errorf(\"%w cause: %v\", errInvalidWorkflowTaskTimeoutSeconds, err)\n\t}\n\n\treturn nil\n}\n\nfunc (v *RequestValidator) ValidateRetryPolicy(namespaceName string, retryPolicy *commonpb.RetryPolicy) error {\n\tif retryPolicy == nil {\n\t\t// By default, if the user does not explicitly set a retry policy for a Workflow, do not perform any retries.\n\t\treturn nil\n\t}\n\n\tretrypolicy.EnsureDefaults(retryPolicy, v.config.defaultWorkflowRetrySettings(namespaceName))\n\treturn retrypolicy.Validate(retryPolicy)\n}\n\nfunc (v *RequestValidator) ValidateWorkflowStartDelay(\n\tcronSchedule string,\n\tstartDelay *durationpb.Duration,","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/chasm/lib/workflow/validator.go#L63-L99","documentation":"Same validation pattern applied to WorkflowTaskTimeout: invalid (negative, sub-second, or over-cap) task timeout durations are wrapped with errInvalidWorkflowTaskTimeoutSeconds. The task timeout governs how long a workflow task may run before timing out.","triggerScenarios":"Calling StartWorkflowExecution or SignalWithStart (through ValidateSignalWithStartRequest) with request.WorkflowTaskTimeout negative, sub-second, or exceeding the maximum allowed task timeout.","commonSituations":"Clients defaulting task timeout to something like 10s500ms; typo producing a negative duration; requesting a task timeout larger than the server cap (common when trying to allow long-running handlers instead of using heartbeating).","solutions":["Set WorkflowTaskTimeout to a positive whole-seconds duration within the server cap (e.g. 10s), or leave unset for the default","Use heartbeating/continued tasks instead of raising the task timeout beyond the cap","Fix any duration arithmetic producing fractional or negative values","Check the server's maximum task timeout configuration and match client requests to it"],"exampleFix":"// before\nreq.WorkflowTaskTimeout = durationpb.New(30 * time.Minute)\n// after\nreq.WorkflowTaskTimeout = durationpb.New(10 * time.Second)","handlingStrategy":"validation","validationCode":"func validTaskTimeout(d *durationpb.Duration) bool {\n    if d == nil { return true }\n    dur := d.AsDuration()\n    return dur > 0 && dur%time.Second == 0 && dur <= maxAllowedTaskTimeout\n}\n// call before StartWorkflowExecution / SignalWithStart:\nif !validTaskTimeout(req.WorkflowTaskTimeout) { /* fix or clear field */ }","typeGuard":null,"tryCatchPattern":"// Go\nif err := validator.ValidateWorkflowTimeouts(req); err != nil {\n    if errors.Is(err, errInvalidWorkflowTaskTimeoutSeconds) {\n        return status.Errorf(codes.InvalidArgument, \"task timeout: %v\", err)\n    }\n    return err\n}","preventionTips":["Use the server default task timeout unless there is a strong reason otherwise","Keep task timeout small and use heartbeats for long work, not huge timeouts","Round to whole seconds and stay within server caps","Validate all three timeouts together before submitting the request"],"tags":["chasm","validation","timeout","workflow"],"backgroundTag":"invalid-workflow-timeout","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}