{"record":{"id":"c74d9b73717c34a7","repo":"argoproj/argo-workflows","slug":"invalidargument","errorCode":"InvalidArgument","errorMessage":"both name and namespace are required if uid is not specified","messagePattern":"both name and namespace are required if uid is not specified","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"persist/sqldb/workflow_archive.go","lineNumber":606,"sourceCode":"\nfunc nameContainsClause(nameSubstring string) db.Cond {\n\tif nameSubstring != \"\" {\n\t\treturn db.Cond{\"name LIKE\": \"%\" + nameSubstring + \"%\"}\n\t}\n\treturn db.Cond{}\n}\n\nfunc phaseEqual(phase string) db.Cond {\n\tif phase != \"\" {\n\t\treturn db.Cond{\"phase\": phase}\n\t}\n\treturn db.Cond{}\n}\n\nfunc (r *workflowArchive) GetWorkflow(ctx context.Context, uid string, namespace string, name string) (*wfv1.Workflow, error) {\n\tlogger := logging.RequireLoggerFromContext(ctx)\n\tif uid == \"\" && (name == \"\" || namespace == \"\") {\n\t\treturn nil, sutils.ToStatusError(fmt.Errorf(\"both name and namespace are required if uid is not specified\"), codes.InvalidArgument)\n\t}\n\tvar result *wfv1.Workflow\n\terr := r.sessionProxy.With(ctx, func(s db.Session) error {\n\t\tarchivedWf := &archivedWorkflowRecord{}\n\t\tvar err error\n\t\tif uid != \"\" {\n\t\t\terr = s.SQL().\n\t\t\t\tSelect(\"workflow\").\n\t\t\t\tFrom(archiveTableName).\n\t\t\t\tWhere(r.clusterManagedNamespaceAndInstanceID()).\n\t\t\t\tAnd(db.Cond{\"uid\": uid}).\n\t\t\t\tOne(archivedWf)\n\t\t} else {\n\t\t\ttotal := &archivedWorkflowCount{}\n\t\t\terr = s.SQL().\n\t\t\t\tSelect(db.Raw(\"count(*) as total\")).\n\t\t\t\tFrom(archiveTableName).\n\t\t\t\tWhere(r.clusterManagedNamespaceAndInstanceID()).","sourceCodeStart":588,"sourceCodeEnd":624,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/persist/sqldb/workflow_archive.go#L588-L624","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pass the workflow uid when you have it","Otherwise pass both name AND namespace: GetWorkflow(ctx, \"\", namespace, name)","In the CLI, supply -n <namespace> along with the workflow name"],"exampleFix":"// before\nwf, err := archiveClient.GetWorkflow(ctx, \"\", \"\", \"my-wf\")\n// after\nwf, err := archiveClient.GetWorkflow(ctx, \"\", \"argo-ns\", \"my-wf\")","handlingStrategy":"validation","validationCode":"func getArchived(ctx context.Context, c workflowarchivepkg.ArchivedWorkflowServiceClient, uid, ns, name string) (*wfv1.Workflow, error) {\n    if uid == \"\" && (name == \"\" || ns == \"\") {\n        return nil, errors.New(\"provide uid, or both name and namespace\")\n    }\n    return c.GetWorkflow(ctx, &workflowarchivepkg.GetWorkflowRequest{Uid: uid, Name: name, Namespace: ns})\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always prefer uid lookups for archived workflows (uids survive renames)","Capture workflow namespace whenever you capture its name","In CLI usage, pass -n <namespace> with the workflow name"],"tags":["grpc","validation","archive","cli"],"backgroundTag":"missing-required-argument","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"}