{"record":{"id":"2e331e0b0453ec5f","repo":"argoproj/argo-workflows","slug":"generated-artifact-key-failed-self-validation-w","errorCode":null,"errorMessage":"generated artifact key failed self-validation: %w","messagePattern":"generated artifact key failed self-validation: %w","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"server/artifacts/artifact_server.go","lineNumber":241,"sourceCode":"\tif !artifactCopy.HasLocation() {\n\t\thttp.Error(w, fmt.Sprintf(\"Artifact '%s' does not have a storage location configured (s3, gcs, azure, oss). Please configure a storage location in the WorkflowTemplate or set up a default artifact repository.\", artifactName), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// Generate unique key for the artifact\n\tuploadUUID := uuid.NewString()\n\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})","sourceCodeStart":223,"sourceCodeEnd":259,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/server/artifacts/artifact_server.go#L223-L259","documentation":"While generating a unique artifact key for an input-artifact upload, the constructed key failed the key-format self-check (invalid characters or shape after sanitizing the filename). The upload request is aborted rather than storing under a malformed key.","triggerScenarios":"Thrown at server/artifacts/artifact_server.go:241 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the artifact name/filename for characters the key format disallows","Report the wrapped validation error; avoid exotic filenames in artifact names"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}