{"record":{"id":"404e66c8f6dbec25","repo":"hashicorp/nomad","slug":"artifact-d-validation-failed-v","errorCode":null,"errorMessage":"Artifact %d validation failed: %v","messagePattern":"Artifact (.+?) validation failed: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/structs.go","lineNumber":8319,"sourceCode":"\t\t}\n\t} else {\n\t\tfor idx, affinity := range t.Affinities {\n\t\t\tif err := affinity.Validate(); err != nil {\n\t\t\t\touter := fmt.Errorf(\"Affinity %d validation failed: %s\", idx+1, err)\n\t\t\t\tmErr.Errors = append(mErr.Errors, outer)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Validate Services\n\tif err := validateServices(t, tg.Networks); err != nil {\n\t\tmErr.Errors = append(mErr.Errors, err)\n\t}\n\n\t// Validate artifacts.\n\tfor idx, artifact := range t.Artifacts {\n\t\tif err := artifact.Validate(); err != nil {\n\t\t\touter := fmt.Errorf(\"Artifact %d validation failed: %v\", idx+1, err)\n\t\t\tmErr.Errors = append(mErr.Errors, outer)\n\t\t}\n\t}\n\n\t// Validate Vault.\n\tif t.Vault != nil {\n\t\tif err := t.Vault.Validate(); err != nil {\n\t\t\tmErr.Errors = append(mErr.Errors, fmt.Errorf(\"Vault validation failed: %v\", err))\n\t\t}\n\t}\n\n\t// Validate templates.\n\tdestinations := make(map[string]int, len(t.Templates))\n\tfor idx, tmpl := range t.Templates {\n\t\tif err := tmpl.Validate(); err != nil {\n\t\t\touter := fmt.Errorf(\"Template %d validation failed: %s\", idx+1, err)\n\t\t\tmErr.Errors = append(mErr.Errors, outer)\n\t\t}","sourceCodeStart":8301,"sourceCodeEnd":8337,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/structs.go#L8301-L8337","documentation":"Emitted in Task validation (nomad/structs/structs.go:8319) when an Artifact in the task fails Artifact.Validate(). It wraps the inner error with the 1-based artifact index; inner causes include invalid source URLs, unsupported schemes, or a destination missing/not absolute.","triggerScenarios":"Task artifact block with source lacking a scheme or using an unsupported one, destination not an absolute path, or checksum format errors; detected when the job is validated.","commonSituations":"Users write source = \"example.com/file.tgz\" without https://; relative destination paths like \"local/\" omitted leading slash misuse; malformed checksums = \"md5:xxx\" values.","solutions":["Read the wrapped inner error to see which artifact (index N from 1) and why.","Give source a full URL with supported scheme (http, https, s3, git, etc.).","Make destination an absolute path inside the alloc dir, e.g. \"/local/file.tgz\".","Verify checksum syntax: algorithm colon hex digest, e.g. checksum = \"sha256:abcd...\"."],"exampleFix":"// before\nartifact {\n  source      = \"example.com/app.tgz\"\n  destination = \"local/app\"\n}\n// after\nartifact {\n  source      = \"https://example.com/app.tgz\"\n  destination = \"/local/app.tgz\"\n}","handlingStrategy":"validation","validationCode":"u, err := url.Parse(a.Source)\nif err != nil || u.Scheme == \"\" {\n  return fmt.Errorf(\"artifact %d: source must be an absolute URL with scheme\", idx+1)\n}\nif !filepath.IsAbs(a.RelativeDest) {\n  return fmt.Errorf(\"artifact %d: destination must be absolute\", idx+1)\n}","typeGuard":"func validArtifactSource(src string) bool {\n  u, err := url.Parse(src)\n  return err == nil && u.Scheme != \"\" && u.Host != \"\"\n}","tryCatchPattern":null,"preventionTips":["Always include the scheme in artifact source URLs.","Use absolute destinations under /local or /secrets.","Check checksum = \"algo:hexdigest\" formatting."],"tags":["nomad","validation","artifacts","job-spec"],"backgroundTag":"invalid-config-value","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}