{"record":{"id":"cc7d5e4015e334e3","repo":"hashicorp/nomad","slug":"hg-timeout-not-a-valid-duration-w","errorCode":null,"errorMessage":"hg_timeout not a valid duration: %w","messagePattern":"hg_timeout not a valid duration: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/config/artifact.go","lineNumber":206,"sourceCode":"\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\")\n\t}\n\n\tif a.DecompressionFileCountLimit == nil {\n\t\treturn fmt.Errorf(\"decompression_file_count_limit must not be nil\")\n\t}\n\tif v := *a.DecompressionFileCountLimit; v < 0 {\n\t\treturn fmt.Errorf(\"decompression_file_count_limit must be >= 0 but found %d\", v)","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/config/artifact.go#L188-L224","documentation":"Returned by ArtifactConfig.Validate when hg_timeout is set but time.ParseDuration cannot parse the string as a Go duration. Valid values look like \"5m\", \"30s\", \"1h\"; the wrapped error indicates the malformed portion.","triggerScenarios":"Setting `hg_timeout` to \"5\" (unit missing), \"5 minutes\", \"5min\", \"\", or a numeric value injected by templating without a suffix.","commonSituations":"Assuming bare integers mean seconds; copying duration formats from non-Go tooling; env var substitution stripping units; typos like \"5 m\" with an internal space.","solutions":["Use a valid Go duration string, e.g. `hg_timeout = \"5m\"` or \"300s\".","Ensure templated values carry the unit suffix.","Read the wrapped %w error to locate the exact invalid characters.","Confirm with `nomad validate` before restarting the agent."],"exampleFix":"// before\nartifact {\n  hg_timeout = \"300\"\n}\n// after\nartifact {\n  hg_timeout = \"300s\"\n}","handlingStrategy":"validation","validationCode":"func validHgTimeout(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":["Always write Go-style durations with units: \"5m\", \"300s\".","Do not rely on bare integers being interpreted as seconds.","Run `nomad validate` on all artifact config before rollout."],"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"}