argoproj/argo-workflows · error

failed to get and store artifact data: %w

Error message

failed to get and store artifact data: %w

What it means

The per-artifact download helper getAndStoreArtifactData failed while fetching or writing the artifact over the argo server HTTP artifact endpoint. All failures inside the helper (request creation, auth, HTTP errors, file write) are wrapped by this message in the cp loop.

Source

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

				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)
				}
			}
			return nil
		},
	}
	command.Flags().StringVarP(&namespace, "namespace", "n", "", "namespace of workflow")
	command.Flags().StringVar(&nodeID, "node-id", "", "id of node in workflow")
	command.Flags().StringVar(&templateName, "template-name", "", "name of template in workflow")
	command.Flags().StringVar(&artifactName, "artifact-name", "", "name of output artifact in workflow")
	command.Flags().StringVar(&customPath, "path", "{namespace}/{workflowName}/{nodeId}/outputs/{artifactName}", "use variables {workflowName}, {nodeId}, {templateName}, {artifactName}, and {namespace} to create a customized path to store the artifacts; example: {workflowName}/{templateName}/{artifactName}")
	return command
}

func newArtifactHTTPClient(opts apiclient.ArgoServerOpts) (*http.Client, error) {
	tlsConfig, err := tlsutil.GetClientTLSConfig(opts.ClientCert, opts.ClientKey, opts.CACert, opts.InsecureSkipVerify)
	if err != nil {
		return nil, err
	}

View on GitHub (pinned to 35bff19146)

Solutions

  1. Read the wrapped inner error to distinguish network, HTTP status, auth, and file-write failures.
  2. Verify server access: `argo list` succeeds and `kubectl -n argo port-forward svc/argo-server 2746:2746` is running if local.
  3. Fix auth/TLS env: ARGO_TOKEN, client certs, ARGO_INSECURE_SKIP_VERIFY, or CA cert.
  4. Confirm the artifact exists in storage (`argo artifact list my-wf`) and retry only the missing one with --artifact-name.

Example fix

// before (server not reachable, no port-forward)
argo cp my-wf ./out
// after
kubectl -n argo port-forward svc/argo-server 2746:2746 &
argo cp my-wf ./out
Defensive patterns

Strategy: retry

Validate before calling

# ensure server is reachable before copying
argo list --limit 1 >/dev/null || { echo "argo server unreachable"; exit 1; }

Try / catch

// retry transient download failures
var lastErr error
for i := 0; i < 3; i++ {
  if err := getAndStoreArtifactData(...); err == nil { break }
  lastErr = err
  time.Sleep(2 * time.Second)
}

Prevention

When it happens

Trigger: Running `argo cp` when the artifact HTTP GET fails: server unreachable, 401/403 auth errors, non-200 status, TLS misconfiguration, or local file write errors inside the helper.

Common situations: argo-server not exposed or wrong ARGO_SERVER URL; expired/missing ARGO_TOKEN; self-signed certs without CA config (ARGO_INSECURE_SKIP_VERIFY / CA cert); artifact deleted from storage (404); read-only output dir.

Related errors


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