{"record":{"id":"1adadb021f20ce62","repo":"temporalio/temporal","slug":"errinvalidworkflowruntimeoutseconds","errorCode":"errInvalidWorkflowRunTimeoutSeconds","errorMessage":"%w cause: %v","messagePattern":"%w cause: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"chasm/lib/workflow/validator.go","lineNumber":77,"sourceCode":"\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}\n\n\tretrypolicy.EnsureDefaults(retryPolicy, v.config.defaultWorkflowRetrySettings(namespaceName))\n\treturn retrypolicy.Validate(retryPolicy)\n}","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/chasm/lib/workflow/validator.go#L59-L95","documentation":"Same validation pattern as the execution timeout, applied to WorkflowRunTimeout: timestamp.ValidateAndCapProtoDuration rejects invalid values and the validator wraps the cause with errInvalidWorkflowRunTimeoutSeconds. Run timeouts must be valid, positive, whole-second durations within the server cap.","triggerScenarios":"Calling StartWorkflowExecution or SignalWithStart (through ValidateSignalWithStartRequest) with request.WorkflowRunTimeout negative, sub-second, or exceeding the configured maximum.","commonSituations":"Passing a time.Duration computed from milliseconds (e.g. 1500ms) which fails the whole-seconds validation; negative values from clock/deadline math bugs; exceeding operator-configured timeout caps after a server config change.","solutions":["Set WorkflowRunTimeout to a positive whole-seconds duration within the cap, or leave it unset to inherit execution timeout","Audit client duration math to avoid sub-second or negative values","Verify server-side timeout cap dynamic config; raise it or lower the requested value"],"exampleFix":"// before\nreq.WorkflowRunTimeout = durationpb.New(1500 * time.Millisecond)\n// after\nreq.WorkflowRunTimeout = durationpb.New(2 * time.Second)","handlingStrategy":"validation","validationCode":"func validRunTimeout(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 / SignalWithStart:\nif !validRunTimeout(req.WorkflowRunTimeout) { /* fix or clear field */ }","typeGuard":null,"tryCatchPattern":"// Go\nif err := validator.ValidateWorkflowTimeouts(req); err != nil {\n    if errors.Is(err, errInvalidWorkflowRunTimeoutSeconds) {\n        return status.Errorf(codes.InvalidArgument, \"run timeout: %v\", err)\n    }\n    return err\n}","preventionTips":["Round run timeouts up to whole seconds","Ensure run timeout <= execution timeout and both within caps","Avoid millisecond-derived durations in request construction","Leave run timeout unset to inherit execution timeout"],"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"}