{"record":{"id":"b96179406c9a13d6","repo":"temporalio/temporal","slug":"error-validating-continueasnewworkflowexecutioncom","errorCode":null,"errorMessage":"error validating ContinueAsNewWorkflowExecutionCommand TaskQueue: %w. WorkflowType=%s TaskQueue=%s","messagePattern":"error validating ContinueAsNewWorkflowExecutionCommand TaskQueue: %w\\. WorkflowType=(.+?) TaskQueue=(.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"service/history/api/command_attr_validator.go","lineNumber":420,"sourceCode":"\t// Inherit workflow type from previous execution if not provided on command\n\tif attributes.WorkflowType == nil || attributes.WorkflowType.GetName() == \"\" {\n\t\tattributes.WorkflowType = &commonpb.WorkflowType{Name: executionInfo.WorkflowTypeName}\n\t}\n\n\twfType := attributes.WorkflowType.GetName()\n\tif len(wfType) > v.maxIDLengthLimit {\n\t\treturn failedCause, serviceerror.NewInvalidArgumentf(\"WorkflowType on ContinueAsNewWorkflowExecutionCommand exceeds length limit. WorkflowType=%s Length=%d Limit=%d\", wfType, len(wfType), v.maxIDLengthLimit)\n\t}\n\n\t// Inherit task queue from previous execution if not provided on command\n\tif attributes.TaskQueue == nil {\n\t\tattributes.TaskQueue = &taskqueuepb.TaskQueue{\n\t\t\tKind: enumspb.TASK_QUEUE_KIND_NORMAL,\n\t\t}\n\t}\n\tif err := tqid.NormalizeAndValidateUserDefined(\n\t\tattributes.TaskQueue, executionInfo.TaskQueue, executionInfo.TaskQueue, v.maxIDLengthLimit); err != nil {\n\t\treturn failedCause, fmt.Errorf(\"error validating ContinueAsNewWorkflowExecutionCommand TaskQueue: %w. WorkflowType=%s TaskQueue=%s\", err, wfType, attributes.TaskQueue)\n\t}\n\n\tif err := timestamp.ValidateAndCapProtoDuration(attributes.GetWorkflowRunTimeout()); err != nil {\n\t\treturn failedCause, serviceerror.NewInvalidArgumentf(\"Invalid WorkflowRunTimeout on ContinueAsNewWorkflowExecutionCommand: %v. WorkflowType=%s TaskQueue=%s\", err, wfType, attributes.TaskQueue)\n\t}\n\n\tif err := timestamp.ValidateAndCapProtoDuration(attributes.GetWorkflowTaskTimeout()); err != nil {\n\t\treturn failedCause, serviceerror.NewInvalidArgumentf(\"Invalid WorkflowTaskTimeout on ContinueAsNewWorkflowExecutionCommand: %v. WorkflowType=%s TaskQueue=%s\", err, wfType, attributes.TaskQueue)\n\t}\n\n\tif err := timestamp.ValidateAndCapProtoDuration(attributes.GetBackoffStartInterval()); err != nil {\n\t\treturn failedCause, serviceerror.NewInvalidArgumentf(\"Invalid BackoffStartInterval on ContinueAsNewWorkflowExecutionCommand: %v. WorkflowType=%s TaskQueue=%s\", err, wfType, attributes.TaskQueue)\n\t}\n\n\tif attributes.GetWorkflowRunTimeout().AsDuration() == 0 {\n\t\tattributes.WorkflowRunTimeout = executionInfo.WorkflowRunTimeout\n\t}\n","sourceCodeStart":402,"sourceCodeEnd":438,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/service/history/api/command_attr_validator.go#L402-L438","documentation":"ValidateContinueAsNewWorkflowExecutionAttributes rejects a ContinueAsNew command whose TaskQueue fails NormalizeAndValidateUserDefined (empty, too long, or invalid characters) against the max ID length limit. The command then fails the workflow task with this wrapped message.","triggerScenarios":"A workflow calling workflow.NewContinueAsNewError with a TaskQueue option containing an invalid/empty/oversized queue name, detected in history's command validation.","commonSituations":"Dynamically computed task queue names with whitespace or illegal characters; exceeding 255-char ID limits; forgetting to set TaskQueue when the original queue was system-generated.","solutions":["Trim whitespace and sanitize the task queue name before ContinueAsNew","Check length against the server max ID limit (default 255)","Omit the TaskQueue option to inherit the current task queue","Reuse executionInfo task queue rather than a freshly constructed one"],"exampleFix":"// before\nworkflow.NewContinueAsNewError(ctx, fn, opts.TaskQueue(strings.TrimSpace(userInput)))\n// after\nif queue := strings.TrimSpace(userInput); queue != \"\" && len(queue) <= 255 {\n    workflow.NewContinueAsNewError(ctx, fn, opts.TaskQueue(queue))\n}","handlingStrategy":"validation","validationCode":"func validTaskQueue(tq string, max int) bool { tq = strings.TrimSpace(tq); return len(tq) > 0 && len(tq) <= max }","typeGuard":"func asTaskQueueOption(name string) (workflow.ContinueAsNewOption, bool) { if name == \"\" { return nil, false }; return opts.TaskQueue(name), true }","tryCatchPattern":"deferred recovery: recover from panic in workflow and inspect temporal.ApplicationError details for task queue validation failures","preventionTips":["Sanitize and trim dynamic queue names","Enforce 255-char ID limit client-side","Omit TaskQueue to inherit the running queue"],"tags":["taskqueue","workflow","continueasnew","validation","history"],"backgroundTag":"invalid-task-queue","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}