argoproj/argo-workflows · error

InvalidArgument

InvalidArgument

Error message

both name and namespace are required if uid is not specified

What it means

GetWorkflow looks up one archived workflow either by its uid, or by the namespace+name pair (because archives do not have a unique index on name alone). If uid is empty and either name or namespace is missing, the query would be ambiguous or unbounded, so it is rejected as an InvalidArgument gRPC status error.

Source

Thrown at persist/sqldb/workflow_archive.go:606

func nameContainsClause(nameSubstring string) db.Cond {
	if nameSubstring != "" {
		return db.Cond{"name LIKE": "%" + nameSubstring + "%"}
	}
	return db.Cond{}
}

func phaseEqual(phase string) db.Cond {
	if phase != "" {
		return db.Cond{"phase": phase}
	}
	return db.Cond{}
}

func (r *workflowArchive) GetWorkflow(ctx context.Context, uid string, namespace string, name string) (*wfv1.Workflow, error) {
	logger := logging.RequireLoggerFromContext(ctx)
	if uid == "" && (name == "" || namespace == "") {
		return nil, sutils.ToStatusError(fmt.Errorf("both name and namespace are required if uid is not specified"), codes.InvalidArgument)
	}
	var result *wfv1.Workflow
	err := r.sessionProxy.With(ctx, func(s db.Session) error {
		archivedWf := &archivedWorkflowRecord{}
		var err error
		if uid != "" {
			err = s.SQL().
				Select("workflow").
				From(archiveTableName).
				Where(r.clusterManagedNamespaceAndInstanceID()).
				And(db.Cond{"uid": uid}).
				One(archivedWf)
		} else {
			total := &archivedWorkflowCount{}
			err = s.SQL().
				Select(db.Raw("count(*) as total")).
				From(archiveTableName).
				Where(r.clusterManagedNamespaceAndInstanceID()).

View on GitHub (pinned to 35bff19146)

Solutions

  1. Pass the workflow uid when you have it
  2. Otherwise pass both name AND namespace: GetWorkflow(ctx, "", namespace, name)
  3. In the CLI, supply -n <namespace> along with the workflow name

Example fix

// before
wf, err := archiveClient.GetWorkflow(ctx, "", "", "my-wf")
// after
wf, err := archiveClient.GetWorkflow(ctx, "", "argo-ns", "my-wf")
Defensive patterns

Strategy: validation

Validate before calling

func getArchived(ctx context.Context, c workflowarchivepkg.ArchivedWorkflowServiceClient, uid, ns, name string) (*wfv1.Workflow, error) {
    if uid == "" && (name == "" || ns == "") {
        return nil, errors.New("provide uid, or both name and namespace")
    }
    return c.GetWorkflow(ctx, &workflowarchivepkg.GetWorkflowRequest{Uid: uid, Name: name, Namespace: ns})
}

Prevention

When it happens

Trigger: Calling the ArchivedWorkflowService.GetWorkflow RPC (via the argo CLI `argo archive get`, SDK, or direct-kube transport) with uid="" and name="" or namespace=""; CLI callers passing only --name while the namespace is not inferred from context.

Common situations: Scripts that parse a workflow name but not the namespace before calling the archive API; using `argo archive get <name>` without the -n namespace flag matching where the workflow ran; deleted workflows whose uid was never captured.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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