argoproj/argo-workflows · error

could not get node status for node ID %s

Error message

could not get node status for node ID %s

What it means

After searching artifacts, `argo cp` looks up each artifact's NodeID in workflow.Status.Nodes to render path variables like {templateName}. This error is returned when a matching NodeStatus cannot be found for an artifact's NodeID, so path substitution cannot proceed.

Source

Thrown at cmd/argo/commands/cp.go:86

			workflowName = workflow.Name
			artifactSearchQuery := v1alpha1.ArtifactSearchQuery{
				ArtifactName: artifactName,
				TemplateName: templateName,
				NodeId:       nodeID,
			}
			artifactSearchResults := workflow.SearchArtifacts(&artifactSearchQuery)

			c, err := newArtifactHTTPClient(client.ArgoServerOpts)
			if err != nil {
				return err
			}

			for _, artifact := range artifactSearchResults {
				outputPath := filepath.Join(outputDir, customPath)
				nodeInfo := workflow.Status.Nodes.Find(func(n v1alpha1.NodeStatus) bool { return n.ID == artifact.NodeID })
				if nodeInfo == nil {
					return fmt.Errorf("could not get node status for node ID %s", artifact.NodeID)
				}
				outputPath = strings.Replace(outputPath, "{templateName}", wfutil.GetTemplateFromNode(*nodeInfo), 1)
				outputPath = strings.Replace(outputPath, "{namespace}", namespace, 1)
				outputPath = strings.Replace(outputPath, "{workflowName}", workflowName, 1)
				outputPath = strings.Replace(outputPath, "{nodeId}", artifact.NodeID, 1)
				outputPath = strings.Replace(outputPath, "{artifactName}", artifact.Name, 1)
				err = os.MkdirAll(outputPath, os.ModePerm)
				if err != nil {
					return fmt.Errorf("failed to create folder path: %w", err)
				}
				key, err := artifact.GetKey()
				if err != nil {
					return fmt.Errorf("error getting key for artifact: %w", err)
				}
				err = getAndStoreArtifactData(ctx, namespace, workflowName, artifact.NodeID, artifact.Name, path.Base(key), outputPath, c, client.ArgoServerOpts)
				if err != nil {
					return fmt.Errorf("failed to get and store artifact data: %w", err)
				}

View on GitHub (pinned to 35bff19146)

Solutions

  1. Retry against the workflow generation that actually owns the artifact (use the original workflow name for retried runs).
  2. Narrow the search with --node-id/--template-name/--artifact-name so stale results are skipped.
  3. Upgrade to a version where artifact search results are guaranteed to reference current node status; report if reproducible on latest.
  4. As a workaround, fetch artifacts directly by name via `argo artifact get`.

Example fix

// before (copies everything incl. stale-generation artifacts)
argo cp retried-wf ./out
// after (target a specific node)
argo cp retried-wf ./out --node-id=retried-wf-1234567890
Defensive patterns

Strategy: fallback

Validate before calling

// pre-check: artifact node IDs exist in status (Go client)
for _, a := range workflow.SearchArtifacts(q) {
  if workflow.Status.Nodes.Find(func(n v1alpha1.NodeStatus) bool { return n.ID == a.NodeID }) == nil {
    fmt.Printf("skipping artifact %s: node %s not in status\n", a.Name, a.NodeID)
  }
}

Type guard

func nodeExists(wf *v1alpha1.Workflow, nodeID string) bool {
  return wf != nil && wf.Status.Nodes.Find(func(n v1alpha1.NodeStatus) bool { return n.ID == nodeID }) != nil
}

Try / catch

if strings.Contains(err.Error(), "could not get node status") {
  log.Printf("skipping artifacts from pruned/previous-generation nodes")
  return nil
}

Prevention

When it happens

Trigger: An ArtifactSearchResult references a NodeID absent from the fetched workflow's Status.Nodes — typically when node status has been offloaded/compressed and not hydrated, or when the search returns nodes from a prior (retried/resubmitted) generation whose node IDs no longer appear in current status.

Common situations: Copying artifacts from a retried workflow where artifacts belong to nodes from a previous attempt; very large workflows where node status was offloaded to the database; controller pruning or boundary-node state that removed the node entry.

Related errors


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