argoproj/argo-workflows · error

NotFound

NotFound

Error message

cron workflow was not found in the request body

What it means

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.

Source

Thrown at server/cronworkflow/cron_workflow_server.go:63

}

func (c *cronWorkflowServiceServer) ListCronWorkflows(ctx context.Context, req *cronworkflowpkg.ListCronWorkflowsRequest) (*v1alpha1.CronWorkflowList, error) {
	options := &metav1.ListOptions{}
	if req.ListOptions != nil {
		options = req.ListOptions
	}
	c.instanceIDService.With(options)
	cronWfList, err := auth.GetWfClient(ctx).ArgoprojV1alpha1().CronWorkflows(req.Namespace).List(ctx, *options)
	if err != nil {
		return nil, sutils.ToStatusError(err, codes.Internal)
	}
	return cronWfList, nil
}

func (c *cronWorkflowServiceServer) CreateCronWorkflow(ctx context.Context, req *cronworkflowpkg.CreateCronWorkflowRequest) (*v1alpha1.CronWorkflow, error) {
	wfClient := auth.GetWfClient(ctx)
	if req.CronWorkflow == nil {
		return nil, sutils.ToStatusError(fmt.Errorf("cron workflow was not found in the request body"), codes.NotFound)
	}
	c.instanceIDService.Label(req.CronWorkflow)
	creator.LabelCreator(ctx, req.CronWorkflow)
	wftmplGetter := c.wftmplStore.Getter(ctx, req.Namespace)
	cwftmplGetter := c.cwftmplStore.Getter(ctx)
	err := validate.CronWorkflow(ctx, wftmplGetter, cwftmplGetter, req.CronWorkflow, c.wfDefaults)
	if err != nil {
		return nil, sutils.ToStatusError(err, codes.InvalidArgument)
	}
	crWf, err := wfClient.ArgoprojV1alpha1().CronWorkflows(req.Namespace).Create(ctx, req.CronWorkflow, metav1.CreateOptions{})
	if err != nil {
		return nil, sutils.ToStatusError(err, codes.Internal)
	}
	return crWf, nil
}

func (c *cronWorkflowServiceServer) GetCronWorkflow(ctx context.Context, req *cronworkflowpkg.GetCronWorkflowRequest) (*v1alpha1.CronWorkflow, error) {
	options := metav1.GetOptions{}

View on GitHub (pinned to 35bff19146)

Solutions

  1. Pass the file: `argo cron create -f cron.yaml` or set `CreateCronWorkflowRequest.CronWorkflow` in the SDK.
  2. Confirm the raw REST/gRPC body is `{"cronWorkflow": {...}}`.
  3. Check the YAML file is non-empty and parses (`argo cron lint cron.yaml`).
  4. When constructing programmatically, ensure you assign the built object to the request field, not a local variable.
  5. If you get this despite a body, log the serialized request to confirm field casing (`cronWorkflow`, lowercase c).

Example fix

// before
req := &cronworkflowpkg.CreateCronWorkflowRequest{Namespace: ns}
// after
cronWf, _ := utils.ParseCronWfYamlFile("cron.yaml")
req := &cronworkflowpkg.CreateCronWorkflowRequest{Namespace: ns, CronWorkflow: cronWf}
Defensive patterns

Strategy: validation

Validate before calling

func validateCronCreateReq(req *cronworkflowpkg.CreateCronWorkflowRequest) error {
	if req == nil || req.CronWorkflow == nil {
		return errors.New("request must include cronWorkflow object")
	}
	return nil
}

Try / catch

_, err := client.CreateCronWorkflow(ctx, req)
if err != nil {
	if st, ok := status.FromError(err); ok && st.Code() == codes.NotFound {
		// server maps nil-body to NotFound; attach CronWorkflow and retry once
	}
	return err
}

Prevention

When it happens

Trigger: `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.

Common situations: 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.

Understand the failure class

Background: "Not Found" / HTTP 404 Errors: What They Mean and How to Fix Them Across Libraries — this error's family across 6 libraries.

Related errors


AI-assisted analysis of argoproj/argo-workflows@35bff19146 (2026-09-03). Data as JSON: /api/errors/16dce1aaee1c3198. Report an issue: GitHub.