{"record":{"id":"ee1ddb4c0e4d024d","repo":"argoproj/argo-workflows","slug":"failed-to-get-workflowartifactgctask-by-key-q-w","errorCode":null,"errorMessage":"failed to get WorkflowArtifactGCTask by key %q: %w","messagePattern":"failed to get WorkflowArtifactGCTask by key %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"workflow/controller/artifact_gc.go","lineNumber":349,"sourceCode":"\t\tif !found {\n\t\t\tartifactsByNode[artifactSearchResult.NodeID] = wfv1.ArtifactNodeSpec{\n\t\t\t\tArchiveLocation: archiveLocation,\n\t\t\t\tArtifacts:       make(map[string]wfv1.Artifact),\n\t\t\t}\n\t\t\tartifactNodeSpec = artifactsByNode[artifactSearchResult.NodeID]\n\t\t}\n\n\t\tartifactNodeSpec.Artifacts[artifactSearchResult.Name] = artifactSearchResult.Artifact\n\t}\n\twoc.log.WithFields(logging.Fields{\"template\": template.Name, \"task\": currentTask.Name, \"artifacts\": artifactsByNode}).Debug(ctx, \"list of artifacts pertaining to template\")\n}\n\n// find WorkflowArtifactGCTask CRD object by name\nfunc (woc *wfOperationCtx) getArtifactTask(taskName string) (*wfv1.WorkflowArtifactGCTask, error) {\n\tkey := woc.wf.Namespace + \"/\" + taskName\n\ttask, exists, err := woc.controller.artGCTaskInformer.Informer().GetIndexer().GetByKey(key)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get WorkflowArtifactGCTask by key %q: %w\", key, err)\n\t}\n\tif !exists {\n\t\treturn nil, nil\n\t}\n\treturn task.(*wfv1.WorkflowArtifactGCTask), nil\n}\n\n// create WorkflowArtifactGCTask CRD object\nfunc (woc *wfOperationCtx) createWorkflowArtifactGCTask(ctx context.Context, task *wfv1.WorkflowArtifactGCTask) (*wfv1.WorkflowArtifactGCTask, error) {\n\t// first make sure it doesn't already exist\n\tfoundTask, err := woc.getArtifactTask(task.Name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif foundTask != nil {\n\t\twoc.log.WithField(\"task\", task.Name).Debug(ctx, \"Artifact GC Task already exists\")\n\t} else {\n\t\twoc.log.WithField(\"task\", task.Name).Info(ctx, \"Creating Artifact GC Task\")","sourceCodeStart":331,"sourceCodeEnd":367,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/workflow/controller/artifact_gc.go#L331-L367","documentation":"getArtifactTask looks up a WorkflowArtifactGCTask CR by namespace/name key in the controller's informer cache. GetByKey only errors if the informer's indexer itself fails; this wraps that low-level cache error at workflow/controller/artifact_gc.go:349. It does not mean the task is missing (that returns nil, nil).","triggerScenarios":"The threadSafeStore indexer returns a non-nil error — practically only on empty/invalid keys (e.g. empty task name or namespace) or corrupted informer state after a cache resync failure.","commonSituations":"Controller starting up with a misconfigured informer; a bug producing an empty taskName; severe API-server/watch disruption causing informer re-init concurrent with reconciliation.","solutions":["Check controller logs for informer sync errors around the time of the failure; restart the workflow-controller if the cache is wedged.","Verify woc.wf.Namespace and the generated task name are non-empty in the log line for this error.","Confirm the WorkflowArtifactGCTask CRD is installed and the informer has started (controller logs 'Artifact GC Task' informer readiness).","The reconciliation is requeued automatically; if transient API issues caused it, no action is needed beyond ensuring API server health."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if strings.Contains(err.Error(), \"failed to get WorkflowArtifactGCTask by key\") { /* transient cache error: rely on controller requeue; restart controller if persistent */ }","preventionTips":["Monitor controller informer sync health metrics/logs.","Ensure the WorkflowArtifactGCTask CRD is installed before starting the controller.","Restart the controller if cache errors persist across reconciles."],"tags":["kubernetes","informer-cache","artifact-gc","workflow-controller"],"backgroundTag":"informer-cache-error","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"}