{"record":{"id":"1b606a258a681209","repo":"argoproj/argo-workflows","slug":"failed-to-get-and-store-artifact-data-w","errorCode":null,"errorMessage":"failed to get and store artifact data: %w","messagePattern":"failed to get and store artifact data: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/argo/commands/cp.go","lineNumber":103,"sourceCode":"\t\t\t\tif nodeInfo == nil {\n\t\t\t\t\treturn fmt.Errorf(\"could not get node status for node ID %s\", artifact.NodeID)\n\t\t\t\t}\n\t\t\t\toutputPath = strings.Replace(outputPath, \"{templateName}\", wfutil.GetTemplateFromNode(*nodeInfo), 1)\n\t\t\t\toutputPath = strings.Replace(outputPath, \"{namespace}\", namespace, 1)\n\t\t\t\toutputPath = strings.Replace(outputPath, \"{workflowName}\", workflowName, 1)\n\t\t\t\toutputPath = strings.Replace(outputPath, \"{nodeId}\", artifact.NodeID, 1)\n\t\t\t\toutputPath = strings.Replace(outputPath, \"{artifactName}\", artifact.Name, 1)\n\t\t\t\terr = os.MkdirAll(outputPath, os.ModePerm)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"failed to create folder path: %w\", err)\n\t\t\t\t}\n\t\t\t\tkey, err := artifact.GetKey()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"error getting key for artifact: %w\", err)\n\t\t\t\t}\n\t\t\t\terr = getAndStoreArtifactData(ctx, namespace, workflowName, artifact.NodeID, artifact.Name, path.Base(key), outputPath, c, client.ArgoServerOpts)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"failed to get and store artifact data: %w\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\tcommand.Flags().StringVarP(&namespace, \"namespace\", \"n\", \"\", \"namespace of workflow\")\n\tcommand.Flags().StringVar(&nodeID, \"node-id\", \"\", \"id of node in workflow\")\n\tcommand.Flags().StringVar(&templateName, \"template-name\", \"\", \"name of template in workflow\")\n\tcommand.Flags().StringVar(&artifactName, \"artifact-name\", \"\", \"name of output artifact in workflow\")\n\tcommand.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}\")\n\treturn command\n}\n\nfunc newArtifactHTTPClient(opts apiclient.ArgoServerOpts) (*http.Client, error) {\n\ttlsConfig, err := tlsutil.GetClientTLSConfig(opts.ClientCert, opts.ClientKey, opts.CACert, opts.InsecureSkipVerify)\n\tif err != nil {\n\t\treturn nil, err\n\t}","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/cmd/argo/commands/cp.go#L85-L121","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the wrapped inner error to distinguish network, HTTP status, auth, and file-write failures.","Verify server access: `argo list` succeeds and `kubectl -n argo port-forward svc/argo-server 2746:2746` is running if local.","Fix auth/TLS env: ARGO_TOKEN, client certs, ARGO_INSECURE_SKIP_VERIFY, or CA cert.","Confirm the artifact exists in storage (`argo artifact list my-wf`) and retry only the missing one with --artifact-name."],"exampleFix":"// before (server not reachable, no port-forward)\nargo cp my-wf ./out\n// after\nkubectl -n argo port-forward svc/argo-server 2746:2746 &\nargo cp my-wf ./out","handlingStrategy":"retry","validationCode":"# ensure server is reachable before copying\nargo list --limit 1 >/dev/null || { echo \"argo server unreachable\"; exit 1; }","typeGuard":null,"tryCatchPattern":"// retry transient download failures\nvar lastErr error\nfor i := 0; i < 3; i++ {\n  if err := getAndStoreArtifactData(...); err == nil { break }\n  lastErr = err\n  time.Sleep(2 * time.Second)\n}","preventionTips":["Verify connectivity (`argo list`) before bulk artifact copies.","Configure TLS/CA env correctly to avoid mid-download auth failures.","Wrap scripted cp calls in a retry loop for transient network errors."],"tags":["cli","http","artifacts","network"],"backgroundTag":"artifact-download-failed","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"}