{"record":{"id":"5bea6c4584b245e4","repo":"hashicorp/nomad","slug":"set-environment-variables-must-be-set","errorCode":null,"errorMessage":"set_environment_variables must be set","messagePattern":"set_environment_variables must be set","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/config/artifact.go","lineNumber":251,"sourceCode":"\t\treturn fmt.Errorf(\"decompression_size_limit must be < %d but found %d\", int64(math.MaxInt64), v)\n\t}\n\n\tif a.DisableArtifactInspection == nil {\n\t\treturn fmt.Errorf(\"disable_artifact_inspection must be set\")\n\t}\n\n\tif a.DisableFilesystemIsolation == nil {\n\t\treturn fmt.Errorf(\"disable_filesystem_isolation must be set\")\n\t}\n\n\tfor _, p := range a.FilesystemIsolationExtraPaths {\n\t\tif _, err := landlock.ParsePath(p); err != nil {\n\t\t\treturn fmt.Errorf(\"filesystem_isolation_extra_paths contains invalid lockdown path %q\", p)\n\t\t}\n\t}\n\n\tif a.SetEnvironmentVariables == nil {\n\t\treturn fmt.Errorf(\"set_environment_variables must be set\")\n\t}\n\n\treturn nil\n}\n\nfunc DefaultArtifactConfig() *ArtifactConfig {\n\treturn &ArtifactConfig{\n\t\t// Read timeout for HTTP operations. Must be long enough to\n\t\t// accommodate large/slow downloads.\n\t\tHTTPReadTimeout: new(\"30m\"),\n\n\t\t// Maximum download size. Must be large enough to accommodate\n\t\t// large downloads.\n\t\tHTTPMaxSize: new(\"100GB\"),\n\n\t\t// Timeout for GCS operations. Must be long enough to\n\t\t// accommodate large/slow downloads.\n\t\tGCSTimeout: new(\"30m\"),","sourceCodeStart":233,"sourceCodeEnd":269,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/config/artifact.go#L233-L269","documentation":"ArtifactConfig.Validate requires SetEnvironmentVariables to be explicitly configured (non-nil *map/*[]string) so artifact drivers unambiguously know whether env vars may be set. A nil value means the config never stated intent, so validation rejects it.","triggerScenarios":"Validate() on an ArtifactConfig whose source config omitted set_environment_variables entirely.","commonSituations":"Minimal artifact blocks written before this field existed; agent configs upgraded from older Nomad versions; programmatic ArtifactConfig{} literals missing the field.","solutions":["Add set_environment_variables with an explicit (possibly empty) value to the artifact block","Initialize the field programmatically before Validate (e.g. an empty map/list)","Base the config on DefaultArtifactConfig()"],"exampleFix":"// before\nartifact {\n  disable_filesystem_isolation = false\n}\n// after\nartifact {\n  disable_filesystem_isolation = false\n  set_environment_variables = []\n}","handlingStrategy":"validation","validationCode":"if cfg.Artifact != nil && cfg.Artifact.SetEnvironmentVariables == nil {\n    return errors.New(\"artifact block must set set_environment_variables explicitly\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Include set_environment_variables (even empty) in every artifact block","Re-diff configs against the Nomad version's example config after upgrades","Use DefaultArtifactConfig() as the baseline for programmatic construction"],"tags":["config","validation","nomad-agent"],"backgroundTag":"missing-required-config-field","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"}