{"record":{"id":"d330ed4b282595f3","repo":"argoproj/argo-workflows","slug":"artifactgcstrategy-q-not-valid","errorCode":null,"errorMessage":"ArtifactGCStrategy %q not valid","messagePattern":"ArtifactGCStrategy %q not valid","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"workflow/controller/artifact_gc.go","lineNumber":267,"sourceCode":"\t\t_, _ = h.Write([]byte(label))\n\t\t_, _ = h.Write([]byte(labelValue))\n\t}\n\n\tsortedAnnotations := slices.Sorted(maps.Keys(info.podMetadata.Annotations))\n\tfor _, annotation := range sortedAnnotations {\n\t\tannotationValue := info.podMetadata.Annotations[annotation]\n\t\t_, _ = h.Write([]byte(annotation))\n\t\t_, _ = h.Write([]byte(annotationValue))\n\t}\n\n\tvar abbreviatedName string\n\tswitch strategy {\n\tcase wfv1.ArtifactGCOnWorkflowCompletion:\n\t\tabbreviatedName = \"wfcomp\"\n\tcase wfv1.ArtifactGCOnWorkflowDeletion:\n\t\tabbreviatedName = \"wfdel\"\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"ArtifactGCStrategy %q not valid\", strategy)\n\t}\n\n\treturn fmt.Sprintf(\"%s-artgc-%s-%v\", woc.wf.Name, abbreviatedName, h.Sum32()), nil\n}\n\nfunc (woc *wfOperationCtx) artGCTaskName(podName string, taskIndex int) string {\n\treturn fmt.Sprintf(\"%s-%d\", podName, taskIndex)\n}\n\nfunc (woc *wfOperationCtx) artifactGCPodLabel(podName string) string {\n\thashedPod := fnv.New32a()\n\t_, _ = hashedPod.Write([]byte(podName))\n\treturn fmt.Sprintf(\"%d\", hashedPod.Sum32())\n}\n\nfunc (woc *wfOperationCtx) addTemplateArtifactsToTasks(ctx context.Context, podName string, tasks *[]*wfv1.WorkflowArtifactGCTask, template *wfv1.Template, artifactSearchResults wfv1.ArtifactSearchResults) {\n\tif len(artifactSearchResults) == 0 {\n\t\treturn","sourceCodeStart":249,"sourceCodeEnd":285,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/workflow/controller/artifact_gc.go#L249-L285","documentation":"artGCPodName maps an ArtifactGCStrategy to an abbreviation used in the GC pod name. Only OnWorkflowCompletion and OnWorkflowDeletion are valid; any other strategy value (including Undefined/empty) returns this error at workflow/controller/artifact_gc.go:267.","triggerScenarios":"An artifact's getArtifactGCStrategy resolves to a value outside the two valid strategies — e.g. an unset/empty strategy string, a typo'd strategy in YAML, or artifact-level strategies combined with workflow-level spec.artifactGC in a way that yields Undefined.","commonSituations":"Misspelling the strategy in YAML (e.g. strategy: OnCompletion instead of OnWorkflowCompletion); submitting a workflow where neither workflow-level nor artifact-level strategy is set but GC is somehow invoked; CRD schema changes between Argo versions.","solutions":["Fix the strategy value in the workflow spec: valid values are OnWorkflowCompletion and OnWorkflowDeletion under spec.artifactGC.strategies.","Validate the workflow with argo lint before submitting to catch invalid strategy strings.","Set a workflow-level default strategy (spec.artifactGC) so artifact-level lookups never resolve to Undefined.","Check that the strategy never falls through to wfv1.ArtifactGCStrategyUndefined in your artifact annotations."],"exampleFix":"// before\nartifactGC:\n  strategies:\n    onCompletion: OnCompletion   # invalid value\n// after\nartifactGC:\n  strategy: OnWorkflowCompletion  # valid: OnWorkflowCompletion | OnWorkflowDeletion","handlingStrategy":"validation","validationCode":"strategy := wfv1.ArtifactGCStrategy(\"OnWorkflowCompletion\") // validate before submit\nif strategy != wfv1.ArtifactGCOnWorkflowCompletion && strategy != wfv1.ArtifactGCOnWorkflowDeletion {\n    return fmt.Errorf(\"invalid strategy %q\", strategy)\n}\n// or simply: argo lint workflow.yaml","typeGuard":"func validGCStrategy(s wfv1.ArtifactGCStrategy) bool {\n    return s == wfv1.ArtifactGCOnWorkflowCompletion || s == wfv1.ArtifactGCOnWorkflowDeletion\n}","tryCatchPattern":"if strings.Contains(err.Error(), \"not valid\") { /* fix strategy string in spec and resubmit */ }","preventionTips":["Always run argo lint before submitting workflows with artifact GC.","Copy strategy names from the docs exactly: OnWorkflowCompletion, OnWorkflowDeletion.","Set a workflow-level default strategy to avoid Undefined fallthrough."],"tags":["kubernetes","artifact-gc","configuration","validation"],"backgroundTag":"invalid-enum-value","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"}