{"record":{"id":"f048da54a22b4f98","repo":"temporalio/temporal","slug":"errinvalidworkflowexecutiontimeoutseconds","errorCode":"errInvalidWorkflowExecutionTimeoutSeconds","errorMessage":"%w cause: %v","messagePattern":"%w cause: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"chasm/lib/workflow/validator.go","lineNumber":73,"sourceCode":"\t\treturn ErrWorkflowIDNotSet\n\t}\n\tif len(workflowID) > v.config.maxIDLengthLimit() {\n\t\treturn serviceerror.NewInvalidArgumentf(\"WorkflowId exceeds maximum allowed length (%d/%d)\", len(workflowID), v.config.maxIDLengthLimit())\n\t}\n\treturn nil\n}\n\ntype 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}","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/chasm/lib/workflow/validator.go#L55-L91","documentation":"The CHASM request validator validates workflow execution timeout via timestamp.ValidateAndCapProtoDuration; on failure it wraps the cause with errInvalidWorkflowExecutionTimeoutSeconds. This means the WorkflowExecutionTimeout in the start request is invalid (negative, non-integer seconds, or exceeds the cap).","triggerScenarios":"Calling a start-workflow-style API (e.g. StartWorkflowExecution or, via ValidateSignalWithStartRequest, SignalWithStart) with request.WorkflowExecutionTimeout set to a negative duration, sub-second value, or one exceeding the configured maximum.","commonSituations":"Clients computing timeouts in milliseconds and passing a duration with sub-second precision; accidental negative values from misconfigured deadline arithmetic; tests or scripts setting huge timeouts beyond the server cap.","solutions":["Set WorkflowExecutionTimeout to a whole-number-of-seconds duration > 0 within the server cap (timestamp.ValidateAndCapProtoDuration rules)","Fix duration computation so no fractional/negative values reach the request (e.g. time.Duration truncation to seconds)","Check dynamic config caps on execution timeout for the namespace and align client values","Clear the field (leave zero/unset) if no execution timeout is intended"],"exampleFix":"// before\nreq.WorkflowExecutionTimeout = durationpb.New(-5 * time.Second)\n// after\nreq.WorkflowExecutionTimeout = durationpb.New(3600 * time.Second)","handlingStrategy":"validation","validationCode":"func validTimeout(d *durationpb.Duration) bool {\n    if d == nil { return true }\n    dur := d.AsDuration()\n    return dur > 0 && dur%time.Second == 0\n}\n// call before StartWorkflowExecution:\nif !validTimeout(req.WorkflowExecutionTimeout) { /* fix or clear field */ }","typeGuard":null,"tryCatchPattern":"// Go\nif err := validator.ValidateWorkflowTimeouts(req); err != nil {\n    if errors.Is(err, errInvalidWorkflowExecutionTimeoutSeconds) {\n        return status.Errorf(codes.InvalidArgument, \"execution timeout: %v\", err)\n    }\n    return err\n}","preventionTips":["Use whole-second durations only; truncate time.Duration to seconds","Never compute timeouts from deadlines that can be negative","Keep client timeout values within server-side caps","Leave the field unset when no execution timeout is needed"],"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"}