{"record":{"id":"6b55a8307cdafd73","repo":"argoproj/argo-workflows","slug":"internal","errorCode":"Internal","errorMessage":"failed to marshall cron workflow patch data: %w","messagePattern":"failed to marshall cron workflow patch data: %w","errorType":"error_code","errorClass":null,"httpStatus":500,"severity":"warning","filePath":"server/cronworkflow/cron_workflow_server.go","lineNumber":143,"sourceCode":"\tcrWf, err := setCronWorkflowSuspend(ctx, false, req.Namespace, req.Name)\n\tif err != nil {\n\t\treturn nil, sutils.ToStatusError(err, codes.Internal)\n\t}\n\treturn crWf, nil\n}\n\nfunc (c *cronWorkflowServiceServer) SuspendCronWorkflow(ctx context.Context, req *cronworkflowpkg.CronWorkflowSuspendRequest) (*v1alpha1.CronWorkflow, error) {\n\tcrWf, err := setCronWorkflowSuspend(ctx, true, req.Namespace, req.Name)\n\tif err != nil {\n\t\treturn nil, sutils.ToStatusError(err, codes.Internal)\n\t}\n\treturn crWf, nil\n}\n\nfunc setCronWorkflowSuspend(ctx context.Context, setTo bool, namespace, name string) (*v1alpha1.CronWorkflow, error) {\n\tdata, err := json.Marshal(map[string]any{\"spec\": map[string]any{\"suspend\": setTo}})\n\tif err != nil {\n\t\treturn nil, sutils.ToStatusError(fmt.Errorf(\"failed to marshall cron workflow patch data: %w\", err), codes.Internal)\n\t}\n\tcronWfs, err := auth.GetWfClient(ctx).ArgoprojV1alpha1().CronWorkflows(namespace).Patch(ctx, name, types.MergePatchType, data, metav1.PatchOptions{})\n\tif err != nil {\n\t\treturn nil, sutils.ToStatusError(err, codes.Internal)\n\t}\n\treturn cronWfs, nil\n}\n\nfunc (c *cronWorkflowServiceServer) getCronWorkflowAndValidate(ctx context.Context, namespace string, name string, options metav1.GetOptions) (*v1alpha1.CronWorkflow, error) {\n\twfClient := auth.GetWfClient(ctx)\n\tcronWf, err := wfClient.ArgoprojV1alpha1().CronWorkflows(namespace).Get(ctx, name, options)\n\tif err != nil {\n\t\treturn nil, sutils.ToStatusError(err, codes.Internal)\n\t}\n\terr = c.instanceIDService.Validate(cronWf)\n\tif err != nil {\n\t\treturn nil, sutils.ToStatusError(err, codes.InvalidArgument)\n\t}","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/server/cronworkflow/cron_workflow_server.go#L125-L161","documentation":"setCronWorkflowSuspend builds a JSON merge patch {\"spec\":{\"suspend\":<bool>}} with json.Marshal before patching the CronWorkflow. A marshal failure of a fixed map[string]any of a bool is practically impossible, so this Internal error almost never fires in the field; it exists as a defensive wrap. Callers are ResumeCronWorkflow and SuspendCronWorkflow.","triggerScenarios":"Theoretically only if json.Marshal fails on the literal map — not reachable with current inputs (bool values only). Seen in code paths where Suspend/Resume are invoked and the error surfaced from an unrelated patched-object failure being conflated.","commonSituations":"Reading this in logs usually means you are looking at the sibling error on the next line (the Patch call, also wrapped with codes.Internal) rather than the marshal itself.","solutions":["Look at the wrapped %w cause; if none indicates json type issues, treat this as unreachable and check the Patch error instead.","If you genuinely hit it after modifying the code to include unmarshalable values in the patch map, fix the map contents (e.g. channels/funcs).","For suspend/resume problems, verify the CronWorkflow exists and argo-server RBAC allows `patch cronworkflows`.","Use `argo cron resume`/`suspend <name>` which route through this helper and surface the real underlying error.","Retry the call — transient API-server errors on Patch return the adjacent codes.Internal wrap."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"cronWf, err := client.SuspendCronWorkflow(ctx, &cronworkflowpkg.SuspendCronWorkflowRequest{Namespace: ns, Name: name})\nif err != nil {\n\tif strings.Contains(err.Error(), \"failed to marshall cron workflow patch data\") {\n\t\t// practically unreachable; report bug with wrapped cause\n\t}\n\t// more likely: handle Patch errors (NotFound/Forbidden) separately\n}","preventionTips":["Treat this as a defensive branch; investigate the wrapped inner error first","Distinguish from the adjacent Patch error which is the realistic failure","Keep the patch map limited to marshalable simple values if modifying code","Retry transient Internal errors once before failing"],"tags":["json","cronworkflow","patch","grpc"],"backgroundTag":"json-marshal-failed","analyzedSha":"35bff19146f5a6ada77468c431f2624bd577e373","analyzedAt":"2026-09-03T19:34:35.908Z","contentChangedAt":"2026-09-03T19:34:35.908Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}