{"record":{"id":"8951d7772a9cd861","repo":"argoproj/argo-workflows","slug":"template-artifact-location-not-set","errorCode":null,"errorMessage":"template artifact location not set","messagePattern":"template artifact location not set","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/apis/workflow/v1alpha1/workflow_types.go","lineNumber":1511,"sourceCode":"\treturn v.SetKey(key)\n}\n\nfunc (a *ArtifactLocation) AppendToKey(x string) error {\n\tkey, err := a.GetKey()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn a.SetKey(path.Join(key, x))\n}\n\n// Relocate copies all location info from the parameter, except the key.\n// But only if it does not have a location already.\nfunc (a *ArtifactLocation) Relocate(l *ArtifactLocation) error {\n\tif a.HasLocation() {\n\t\treturn nil\n\t}\n\tif l == nil {\n\t\treturn fmt.Errorf(\"template artifact location not set\")\n\t}\n\tkey, err := a.GetKey()\n\tif err != nil {\n\t\treturn err\n\t}\n\t*a = *l.DeepCopy()\n\treturn a.SetKey(key)\n}\n\n// HasLocation whether or not an artifact has a *full* location defined\n// An artifact that has a location implicitly has a key (i.e. HasKey() == true).\nfunc (a *ArtifactLocation) HasLocation() bool {\n\tv, err := a.Get()\n\treturn err == nil && v.HasLocation()\n}\n\nfunc (a *ArtifactLocation) IsArchiveLogs() bool {\n\treturn a != nil && a.ArchiveLogs != nil && *a.ArchiveLogs","sourceCodeStart":1493,"sourceCodeEnd":1529,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/pkg/apis/workflow/v1alpha1/workflow_types.go#L1493-L1529","documentation":"ArtifactLocation.Relocate copies the template-level artifact location (e.g. the artifact repository defaults with a key prefix) onto an artifact that has no location of its own. If the source template location `l` is nil — meaning the containing template/workflow has no artifact location configured — there is nothing to relocate and this error is returned.","triggerScenarios":"Calling Relocate on an artifact without its own location, passing a nil *ArtifactLocation for the template location; happens in controller/executor code that resolves output artifact paths against the template's artifact location.","commonSituations":"Workflow template created without an artifactRepository/location while an artifact relies on relocation; controller hydrating artifacts from a template whose location was never set.","solutions":["Configure the template/workflow artifact location (artifactRepository in controller config or template's artifactLocation)","Ensure the template used has a non-nil artifact location before artifacts rely on Relocate","Check HasLocation() on the artifact first; if it already has a location, Relocate is a no-op and the nil template location does not matter"],"exampleFix":"// before\ntmpl := &WorkflowTemplate{} // artifact location never set\nerr := art.Locate.Relocate(tmpl.GetArtifactLocation()) // nil -> error\n// after\ntmpl.Spec.Templates[0].ArtifactLocation = &ArtifactLocation{S3: &S3Artifact{Key: \"prefix\"}}\nerr := art.Locate.Relocate(tmpl.GetArtifactLocation())","handlingStrategy":"type-guard","validationCode":"if l == nil {\n    return errors.New(\"template has no artifact location; configure artifactRepository first\")\n}","typeGuard":"func relocateReady(a, l *ArtifactLocation) bool {\n    return a == nil || !a.HasLocation() && l != nil\n}","tryCatchPattern":"if err := art.Locate.Relocate(tmplLoc); err != nil {\n    if strings.Contains(err.Error(), \"template artifact location not set\") {\n        return errors.New(\"configure artifactRepository on the template/controller before running\")\n    }\n    return err\n}","preventionTips":["Skip Relocate when the artifact already HasLocation()","Ensure templates carry a valid artifact location before artifact-dependent logic","Configure artifactRepository at install time"],"tags":["artifacts","artifact-location","configuration"],"backgroundTag":"artifact-storage-not-configured","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"}