argoproj/argo-workflows · error

resolve UID: %w

Error message

resolve UID: %w

What it means

Thrown by `argo archive get` (cmd/argo/commands/archive/get.go) when `resolveUID` cannot turn the given identifier into a single archived-workflow UID before calling GetArchivedWorkflow. The wrapped cause distinguishes: listing failure, no match, or multiple matches for a name.

Source

Thrown at cmd/argo/commands/archive/get.go:61

# Get information about an archived workflow by UID (forced):
  argo archive get a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11 --uid
`,
		RunE: func(cmd *cobra.Command, args []string) error {
			identifier := args[0]

			ctx, apiClient, err := client.NewAPIClient(cmd.Context())
			if err != nil {
				return err
			}
			serviceClient, err := apiClient.NewArchivedWorkflowServiceClient()
			if err != nil {
				return err
			}

			namespace := client.Namespace(ctx)
			uid, err := resolveUID(ctx, serviceClient, identifier, namespace, forceUID, forceName)
			if err != nil {
				return fmt.Errorf("resolve UID: %w", err)
			}

			wf, err := serviceClient.GetArchivedWorkflow(ctx, &workflowarchivepkg.GetArchivedWorkflowRequest{Uid: uid})
			if err != nil {
				return err
			}
			printWorkflow(wf, output.String())
			return nil
		},
	}
	command.Flags().VarP(&output, "output", "o", "Output format. "+output.Usage())
	command.Flags().BoolVar(&forceName, "name", false, "force the argument to be treated as a name")
	command.Flags().BoolVar(&forceUID, "uid", false, "force the argument to be treated as a UID")
	command.MarkFlagsMutuallyExclusive("name", "uid")
	return command
}

func printWorkflow(wf *wfv1.Workflow, output string) {

View on GitHub (pinned to 35bff19146)

Solutions

  1. Use the full UID (visible in `argo archive list`) instead of the name.
  2. Fix the -n namespace flag to match where the workflow ran.
  3. If ambiguous, disambiguate with --force-name plus a more exact name, or pass --force-uid with a true UID.
  4. If the cause is a server/list error, verify connectivity to the argo server and that workflow archival is enabled.

Example fix

// before
argo archive get my-wf

// after
argo archive get e1234567-89ab-cdef-0123-456789abcdef
Defensive patterns

Strategy: validation

Validate before calling

res, _ := archiveClient.ListArchivedWorkflows(ctx, &workflowarchivepkg.ListArchivedWorkflowRequest{
    ListOptions: &metav1.ListOptions{FieldSelector: "metadata.name=" + name},
})
switch len(res.Items) {
case 0: return fmt.Errorf("no archived workflow named %s", name)
case 1: uid = string(res.Items[0].UID)
default: return fmt.Errorf("%d archived workflows named %s; use UID", len(res.Items), name)
}

Try / catch

wf, err := serviceClient.GetArchivedWorkflow(ctx, &workflowarchivepkg.GetArchivedWorkflowRequest{Uid: uid})
if err != nil {
    if strings.Contains(err.Error(), "resolve UID:") {
        // re-list and pick the exact UID
    }
    return err
}

Prevention

When it happens

Trigger: Running `argo archive get <name-or-uid>` where the name does not exactly match any archived workflow, matches more than one, or the ListArchivedWorkflows RPC fails; also when neither --force-uid nor --force-name is set and the identifier is ambiguous.

Common situations: Using a partial/prefixed name where several archived workflows share the prefix; querying a workflow archived in another namespace; stale names after resubmission created multiple archived copies.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — 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/69c05028269f3f28. Report an issue: GitHub.