argoproj/argo-workflows · error

invalid uid

Error message

invalid uid

What it means

nodeOffloadRepo.Delete refuses to issue a SQL DELETE against the offloaded-node-status table when the uid argument is the empty string. The uid identifies the workflow whose offloaded node status rows are being removed, so deleting without one would either fail or delete unintended rows. The guard exists purely to surface caller bugs early instead of producing a confusing database error.

Source

Thrown at persist/sqldb/offload_node_status_repo.go:213

			All(&records)
		if err != nil {
			return err
		}
		x = make(map[string][]string)
		for _, r := range records {
			x[r.UID] = append(x[r.UID], r.Version)
		}
		return nil
	})
	if err != nil {
		return nil, err
	}
	return x, nil
}

func (wdc *nodeOffloadRepo) Delete(ctx context.Context, uid, version string) error {
	if uid == "" {
		return fmt.Errorf("invalid uid")
	}
	if version == "" {
		return fmt.Errorf("invalid version")
	}
	logCtx := wdc.log.WithFields(logging.Fields{"uid": uid, "version": version})
	logCtx.Debug(ctx, "Deleting offloaded nodes")
	return wdc.sessionProxy.With(ctx, func(s db.Session) error {
		rs, err := s.SQL().
			DeleteFrom(wdc.tableName).
			Where(db.Cond{"clustername": wdc.clusterName}).
			And(db.Cond{"uid": uid}).
			And(db.Cond{"version": version}).
			Exec()
		if err != nil {
			return err
		}
		rowsAffected, err := rs.RowsAffected()
		if err != nil {

View on GitHub (pinned to 35bff19146)

Solutions

  1. Fix the caller so it obtains the real workflow uid (metadata.uid) before calling Delete
  2. Add a guard in the caller to skip/log when uid is empty instead of calling Delete
  3. Verify the workflow object you got the uid from was properly created (not a stub/zero struct)

Example fix

// before
err := offloadRepo.Delete(ctx, wf.UID, version)
// after
if wf.UID == "" {
    return fmt.Errorf("workflow %s has no uid, cannot delete offloaded nodes", wf.Name)
}
err := offloadRepo.Delete(ctx, wf.UID, version)
Defensive patterns

Strategy: validation

Validate before calling

if uid == "" {
    return fmt.Errorf("cannot delete offloaded node status: workflow uid is empty")
}
err := offloadRepo.Delete(ctx, uid, version)

Prevention

When it happens

Trigger: Calling Delete(ctx, "", version) on the offload node status repo — e.g. a retry/expiry path that derived the workflow uid from a nil or empty metadata field, or a caller passing an unparsed/blank UID variable.

Common situations: Controller cleanup code (offload expiry, workflow deletion) invoked with a workflow that never got a UID assigned; tests or custom persistence implementations passing zero-value strings; retriggered/retried workflows where uid extraction silently failed.

Related errors


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