{"record":{"id":"0ae1242d24d0c7d1","repo":"hashicorp/nomad","slug":"git-timeout-must-be-0","errorCode":null,"errorMessage":"git_timeout must be > 0","messagePattern":"git_timeout must be > 0","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/config/artifact.go","lineNumber":199,"sourceCode":"\t\treturn fmt.Errorf(\"http_max_size must be < %d but found %d\", int64(math.MaxInt64), v)\n\t}\n\n\tif a.GCSTimeout == nil {\n\t\treturn fmt.Errorf(\"gcs_timeout must be set\")\n\t}\n\tif v, err := time.ParseDuration(*a.GCSTimeout); err != nil {\n\t\treturn fmt.Errorf(\"gcs_timeout not a valid duration: %w\", err)\n\t} else if v < 0 {\n\t\treturn fmt.Errorf(\"gcs_timeout must be > 0\")\n\t}\n\n\tif a.GitTimeout == nil {\n\t\treturn fmt.Errorf(\"git_timeout must be set\")\n\t}\n\tif v, err := time.ParseDuration(*a.GitTimeout); err != nil {\n\t\treturn fmt.Errorf(\"git_timeout not a valid duration: %w\", err)\n\t} else if v < 0 {\n\t\treturn fmt.Errorf(\"git_timeout must be > 0\")\n\t}\n\n\tif a.HgTimeout == nil {\n\t\treturn fmt.Errorf(\"hg_timeout must be set\")\n\t}\n\tif v, err := time.ParseDuration(*a.HgTimeout); err != nil {\n\t\treturn fmt.Errorf(\"hg_timeout not a valid duration: %w\", err)\n\t} else if v < 0 {\n\t\treturn fmt.Errorf(\"hg_timeout must be > 0\")\n\t}\n\n\tif a.S3Timeout == nil {\n\t\treturn fmt.Errorf(\"s3_timeout must be set\")\n\t}\n\tif v, err := time.ParseDuration(*a.S3Timeout); err != nil {\n\t\treturn fmt.Errorf(\"s3_timeout not a valid duration: %w\", err)\n\t} else if v < 0 {\n\t\treturn fmt.Errorf(\"s3_timeout must be > 0\")","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/config/artifact.go#L181-L217","documentation":"Artifact config validation parsed git_timeout but found a negative duration; the timeout must be zero or positive.","triggerScenarios":"Setting `git_timeout = \"-5m\"` or \"-1s\"; computed/templated values producing negatives; accidental minus sign in HCL.","commonSituations":"Dynamic timeout arithmetic going negative; sentinel-value confusion (using -1 for 'unlimited'); sign typos during manual editing.","solutions":["Set git_timeout to a positive duration such as \"10s\"","Remove the negative value so defaults apply"],"exampleFix":"// before\nartifact {\n  git_timeout = \"-5m\"\n}\n// after\nartifact {\n  git_timeout = \"15m\"\n}","handlingStrategy":"validation","validationCode":"func nonNegativeGitTimeout(s string) bool {\n    v, err := time.ParseDuration(s)\n    return err == nil && v >= 0\n}","typeGuard":"func isPositiveDuration(s string) bool {\n    v, err := time.ParseDuration(s)\n    return err == nil && v >= 0\n}","tryCatchPattern":null,"preventionTips":["Clamp dynamic timeout calculations to a positive floor.","Use large positive durations instead of negatives for 'unlimited'.","Review diffs for accidental minus signs."],"tags":["config","validation","duration","nomad"],"backgroundTag":"invalid-duration-format","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"}