{"record":{"id":"e74aa7e9abc6f918","repo":"argoproj/argo-workflows","slug":"failed-to-set-artifact-key-v","errorCode":null,"errorMessage":"Failed to set artifact key: %v","messagePattern":"Failed to set artifact key: (.+?)","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"server/artifacts/artifact_server.go","lineNumber":248,"sourceCode":"\toriginalKey, _ := artifactCopy.GetKey()\n\t// Sanitize filename to prevent path traversal attacks. path.Base only\n\t// recognises '/' as a separator, so normalise Windows-style '\\' first.\n\tsanitizedFilename := path.Base(strings.ReplaceAll(header.Filename, \"\\\\\", \"/\"))\n\tif sanitizedFilename == \".\" || sanitizedFilename == \"/\" || sanitizedFilename == \"\" {\n\t\thttp.Error(w, \"Invalid filename\", http.StatusBadRequest)\n\t\treturn\n\t}\n\t// Replace the key with uploaded file path under uploads/\n\tnewKey := fmt.Sprintf(\"uploads/%s/%s/%s\", namespace, uploadUUID, sanitizedFilename)\n\tif validateErr := sutils.ValidateUploadedArtifactKey(namespace, newKey); validateErr != nil {\n\t\ta.serverInternalError(ctx, fmt.Errorf(\"generated artifact key failed self-validation: %w\", validateErr), w)\n\t\treturn\n\t}\n\n\t// Create a copy of the artifact for uploading (using artifactCopy which has resolved location)\n\toutputArtifact := artifactCopy.DeepCopy()\n\tif setErr := outputArtifact.SetKey(newKey); setErr != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"Failed to set artifact key: %v\", setErr), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\ta.logger.WithFields(logging.Fields{\n\t\t\"originalKey\": originalKey,\n\t\t\"newKey\":      newKey,\n\t}).Info(ctx, \"Uploading artifact with new key\")\n\n\t// Get the driver for the artifact\n\tkubeClient := auth.GetKubeClient(ctx)\n\tdriver, err := a.artDriverFactory(ctx, outputArtifact, resources{kubeClient, namespace})\n\tif err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"Failed to create artifact driver: %v\", err), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Upload using SaveStream\n\tif err := driver.SaveStream(ctx, file, outputArtifact); err != nil {","sourceCodeStart":230,"sourceCodeEnd":266,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/server/artifacts/artifact_server.go#L230-L266","documentation":"After building the new storage key (uploads/<namespace>/<uuid>/<filename>), the server calls outputArtifact.SetKey(newKey). SetKey only supports keys for artifact location types that have a key concept (s3, oss, gcs, etc.); for unsupported location types it returns an error, surfaced as HTTP 500. This indicates the resolved artifact location type cannot hold the generated key.","triggerScenarios":"The resolved artifact location is of a type without key support (e.g. some http/raw-derived or misconfigured location); a custom/default artifact repository resolution produced a location type SetKey does not handle; a bug or unusual artifact configuration where ArtifactLocation has a backend that lacks a Key field.","commonSituations":"Default artifact repository configured with a backend whose location type doesn't accept keys; artifact fields combining incompatible location blocks; upgrades where new location types were added but the upload path wasn't updated.","solutions":["Check the resolved artifact location type; use s3/gcs/azure/oss which support keys.","Inspect the full error (%v of SetKey) in the response to identify the unsupported type.","Fix the artifact definition or default artifact repository so it points at a key-capable backend.","If it persists with a valid configuration, file a bug with the artifact YAML and Argo version."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# Only key-capable backends support upload keys\nkubectl -n $NS get workflowtemplate $TPL -o jsonpath='{range .spec.arguments.artifacts[*]}{.name}{\": \"}{.s3}{.gcs}{.azure}{.oss}{\"\\n\"}{end}'","typeGuard":"function hasKeyCapableLocation(artifact) {\n  return Boolean(artifact.s3 || artifact.gcs || artifact.azure || artifact.oss);\n}","tryCatchPattern":"catch (e) {\n  if (e.status === 500 && e.body.includes('Failed to set artifact key')) {\n    log.error('resolved artifact location type cannot hold an upload key; fix artifact repository config', e);\n  }\n}","preventionTips":["Use s3/gcs/azure/oss locations for uploaded artifacts.","Avoid combining incompatible location fields on one artifact.","Re-check artifact YAML after Argo version upgrades for new/changed location types.","Read the appended SetKey error detail to identify the offending location type."],"tags":["artifacts","storage-key","internal-error","configuration"],"backgroundTag":"unsupported-artifact-location-type","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"}