{"record":{"id":"c8f13b5ab19d5ed6","repo":"hashicorp/nomad","slug":"git-timeout-not-a-valid-duration-w","errorCode":null,"errorMessage":"git_timeout not a valid duration: %w","messagePattern":"git_timeout not a valid duration: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/config/artifact.go","lineNumber":197,"sourceCode":"\t\treturn fmt.Errorf(\"http_max_size not a valid size: %w\", err)\n\t} else if v > math.MaxInt64 {\n\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)","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/config/artifact.go#L179-L215","documentation":"Returned by ArtifactConfig.Validate when git_timeout is set but time.ParseDuration cannot parse the string. The value must be a Go duration literal such as \"5m\", \"30s\", \"1h\"; the wrapped error describes the syntax problem.","triggerScenarios":"Setting `git_timeout` to \"5\" (missing unit), \"5 minutes\", \"5min\", \"\", or a substituted numeric value without a suffix; typos or locale-formatted numbers like \"5,5m\".","commonSituations":"Mixing integer-seconds conventions from other tools with Go duration syntax; environment variable substitution dropping units; hand-editing configs quickly and omitting the unit.","solutions":["Use a valid Go duration string, e.g. `git_timeout = \"5m\"` or \"300s\".","Append the unit when values come from templates/env vars.","Inspect the wrapped %w error for the exact invalid segment.","Validate with `nomad validate` before restarting."],"exampleFix":"// before\nartifact {\n  git_timeout = \"300\"\n}\n// after\nartifact {\n  git_timeout = \"300s\"\n}","handlingStrategy":"validation","validationCode":"func validGitTimeout(s *string) bool {\n    if s == nil { return false }\n    _, err := time.ParseDuration(*s)\n    return err == nil\n}","typeGuard":"func isDuration(s string) bool {\n    _, err := time.ParseDuration(s)\n    return err == nil\n}","tryCatchPattern":null,"preventionTips":["Use unit-suffixed durations (\"300s\", \"5m\"), never bare integers.","Quote templated values and append units at substitution time.","Run `nomad validate` before restarts."],"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"}