{"record":{"id":"16dce1aaee1c3198","repo":"argoproj/argo-workflows","slug":"notfound","errorCode":"NotFound","errorMessage":"cron workflow was not found in the request body","messagePattern":"cron workflow was not found in the request body","errorType":"error_code","errorClass":null,"httpStatus":404,"severity":"error","filePath":"server/cronworkflow/cron_workflow_server.go","lineNumber":63,"sourceCode":"}\n\nfunc (c *cronWorkflowServiceServer) ListCronWorkflows(ctx context.Context, req *cronworkflowpkg.ListCronWorkflowsRequest) (*v1alpha1.CronWorkflowList, error) {\n\toptions := &metav1.ListOptions{}\n\tif req.ListOptions != nil {\n\t\toptions = req.ListOptions\n\t}\n\tc.instanceIDService.With(options)\n\tcronWfList, err := auth.GetWfClient(ctx).ArgoprojV1alpha1().CronWorkflows(req.Namespace).List(ctx, *options)\n\tif err != nil {\n\t\treturn nil, sutils.ToStatusError(err, codes.Internal)\n\t}\n\treturn cronWfList, nil\n}\n\nfunc (c *cronWorkflowServiceServer) CreateCronWorkflow(ctx context.Context, req *cronworkflowpkg.CreateCronWorkflowRequest) (*v1alpha1.CronWorkflow, error) {\n\twfClient := auth.GetWfClient(ctx)\n\tif req.CronWorkflow == nil {\n\t\treturn nil, sutils.ToStatusError(fmt.Errorf(\"cron workflow was not found in the request body\"), codes.NotFound)\n\t}\n\tc.instanceIDService.Label(req.CronWorkflow)\n\tcreator.LabelCreator(ctx, req.CronWorkflow)\n\twftmplGetter := c.wftmplStore.Getter(ctx, req.Namespace)\n\tcwftmplGetter := c.cwftmplStore.Getter(ctx)\n\terr := validate.CronWorkflow(ctx, wftmplGetter, cwftmplGetter, req.CronWorkflow, c.wfDefaults)\n\tif err != nil {\n\t\treturn nil, sutils.ToStatusError(err, codes.InvalidArgument)\n\t}\n\tcrWf, err := wfClient.ArgoprojV1alpha1().CronWorkflows(req.Namespace).Create(ctx, req.CronWorkflow, metav1.CreateOptions{})\n\tif err != nil {\n\t\treturn nil, sutils.ToStatusError(err, codes.Internal)\n\t}\n\treturn crWf, nil\n}\n\nfunc (c *cronWorkflowServiceServer) GetCronWorkflow(ctx context.Context, req *cronworkflowpkg.GetCronWorkflowRequest) (*v1alpha1.CronWorkflow, error) {\n\toptions := metav1.GetOptions{}","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/server/cronworkflow/cron_workflow_server.go#L45-L81","documentation":"CreateCronWorkflow returns this when req.CronWorkflow is nil. Notably it maps the missing-payload guard to gRPC code NotFound (a quirk — InvalidArgument would be conventional), but the meaning is the same: the request contained no CronWorkflow object to create.","triggerScenarios":"`argo cron create` without `-f`, SDK CreateCronWorkflowRequest without CronWorkflow set, grpc-gateway POST body missing the `cronWorkflow` field, or YAML parsed to an empty object because the file was empty or the top-level key was wrong.","commonSituations":"Empty or whitespace-only cron YAML file; key spelled `spec:` at top level instead of `cronWorkflow:` (CLI wraps it, raw API doesn't); copying the Workflow request shape and renaming fields incorrectly; nil deref avoidance in generated clients leaving the field unset.","solutions":["Pass the file: `argo cron create -f cron.yaml` or set `CreateCronWorkflowRequest.CronWorkflow` in the SDK.","Confirm the raw REST/gRPC body is `{\"cronWorkflow\": {...}}`.","Check the YAML file is non-empty and parses (`argo cron lint cron.yaml`).","When constructing programmatically, ensure you assign the built object to the request field, not a local variable.","If you get this despite a body, log the serialized request to confirm field casing (`cronWorkflow`, lowercase c)."],"exampleFix":"// before\nreq := &cronworkflowpkg.CreateCronWorkflowRequest{Namespace: ns}\n// after\ncronWf, _ := utils.ParseCronWfYamlFile(\"cron.yaml\")\nreq := &cronworkflowpkg.CreateCronWorkflowRequest{Namespace: ns, CronWorkflow: cronWf}","handlingStrategy":"validation","validationCode":"func validateCronCreateReq(req *cronworkflowpkg.CreateCronWorkflowRequest) error {\n\tif req == nil || req.CronWorkflow == nil {\n\t\treturn errors.New(\"request must include cronWorkflow object\")\n\t}\n\treturn nil\n}","typeGuard":null,"tryCatchPattern":"_, err := client.CreateCronWorkflow(ctx, req)\nif err != nil {\n\tif st, ok := status.FromError(err); ok && st.Code() == codes.NotFound {\n\t\t// server maps nil-body to NotFound; attach CronWorkflow and retry once\n\t}\n\treturn err\n}","preventionTips":["Use `argo cron create -f cron.yaml` so the CLI populates the field","Verify the file is non-empty and parses before submitting","Use the exact JSON key `cronWorkflow` for raw gateway calls","Assign the parsed object to the request field in SDK code"],"tags":["grpc","api","cronworkflow","request-validation"],"backgroundTag":"missing-request-body-template","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"}