{"record":{"id":"012d9051410d156a","repo":"hashicorp/nomad","slug":"error-parsing-httpreadtimeout-w","errorCode":null,"errorMessage":"error parsing HTTPReadTimeout: %w","messagePattern":"error parsing HTTPReadTimeout: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/config/artifact.go","lineNumber":40,"sourceCode":"\tGitTimeout time.Duration\n\tHgTimeout  time.Duration\n\tS3Timeout  time.Duration\n\n\tDecompressionLimitFileCount int\n\tDecompressionLimitSize      int64\n\n\tDisableArtifactInspection     bool\n\tDisableFilesystemIsolation    bool\n\tFilesystemIsolationExtraPaths []string\n\tSetEnvironmentVariables       string\n}\n\n// ArtifactConfigFromAgent creates a new internal readonly copy of the client\n// agent's ArtifactConfig. The config should have already been validated.\nfunc ArtifactConfigFromAgent(c *config.ArtifactConfig) (*ArtifactConfig, error) {\n\thttpReadTimeout, err := time.ParseDuration(*c.HTTPReadTimeout)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing HTTPReadTimeout: %w\", err)\n\t}\n\n\thttpMaxSize, err := humanize.ParseBytes(*c.HTTPMaxSize)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing HTTPMaxSize: %w\", err)\n\t}\n\n\tgcsTimeout, err := time.ParseDuration(*c.GCSTimeout)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing GCSTimeout: %w\", err)\n\t}\n\n\tgitTimeout, err := time.ParseDuration(*c.GitTimeout)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing GitTimeout: %w\", err)\n\t}\n\n\thgTimeout, err := time.ParseDuration(*c.HgTimeout)","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/config/artifact.go#L22-L58","documentation":"`ArtifactConfigFromAgent` converts the client agent's public artifact config into an internal readonly copy. It parses HTTPReadTimeout with time.ParseDuration and, on failure, wraps the parse error as \"error parsing HTTPReadTimeout: %w\". This is a startup-time configuration validation error: the supplied string is not a valid Go duration (e.g. missing unit).","triggerScenarios":"Starting a Nomad client with client.artifact.http_read_timeout set to an invalid duration string such as \"30\", \"30s4m2\" or \"ten seconds\"; config values injected via environment variables or templating that produce malformed durations.","commonSituations":"Operators setting a bare number assuming seconds (Go durations require units like 30s); config management templates rendering empty strings; copy-pasted config using non-Go duration syntax like 5m30 (valid) vs 5:30 (invalid).","solutions":["Set http_read_timeout to a valid Go duration string including the unit, e.g. \"30m\" or \"1h\"","Validate the rendered config with `nomad agent -config ... -verify` (or run nomad config validate) before deploy","Fix any templating/env interpolation that yields empty or malformed values"],"exampleFix":"// nomad client config\n// before\nclient {\n  artifact {\n    http_read_timeout = \"30\" // missing unit\n  }\n}\n// after\nclient {\n  artifact {\n    http_read_timeout = \"30m\"\n  }\n}","handlingStrategy":"validation","validationCode":"if _, err := time.ParseDuration(cfg.Artifact.HTTPReadTimeout); err != nil {\n    log.Fatalf(\"invalid http_read_timeout %q: %v\", cfg.Artifact.HTTPReadTimeout, err)\n}","typeGuard":null,"tryCatchPattern":"cfg, err := clientconfig.ArtifactConfigFromAgent(agentCfg.Artifact)\nif err != nil {\n    if strings.Contains(err.Error(), \"error parsing HTTPReadTimeout\") {\n        return fmt.Errorf(\"fix client.artifact.http_read_timeout to a Go duration like 30m: %w\", err)\n    }\n    return err\n}","preventionTips":["Always include duration units in config values (30m, 1h), never bare numbers","Validate agent config before deploy with nomad's config validation","Guard templated/env-injected config against empty strings","Add a config linter step in CI that parses all duration fields"],"tags":["nomad","config","parsing","duration"],"backgroundTag":"invalid-duration-config","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"}