hashicorp/nomad · error
error parsing S3Timeout: %w
Error message
error parsing S3Timeout: %w
What it means
In ArtifactConfigFromAgent, the agent's artifact S3Timeout string cannot be parsed by time.ParseDuration, so the artifact fetcher config cannot be built. Indicates a malformed duration value in the agent's artifact config block.
Source
Thrown at client/config/artifact.go:65
gcsTimeout, err := time.ParseDuration(*c.GCSTimeout)
if err != nil {
return nil, fmt.Errorf("error parsing GCSTimeout: %w", err)
}
gitTimeout, err := time.ParseDuration(*c.GitTimeout)
if err != nil {
return nil, fmt.Errorf("error parsing GitTimeout: %w", err)
}
hgTimeout, err := time.ParseDuration(*c.HgTimeout)
if err != nil {
return nil, fmt.Errorf("error parsing HgTimeout: %w", err)
}
s3Timeout, err := time.ParseDuration(*c.S3Timeout)
if err != nil {
return nil, fmt.Errorf("error parsing S3Timeout: %w", err)
}
decompressionSizeLimit, err := humanize.ParseBytes(*c.DecompressionSizeLimit)
if err != nil {
return nil, fmt.Errorf("error parsing DecompressionLimitSize: %w", err)
}
return &ArtifactConfig{
HTTPReadTimeout: httpReadTimeout,
HTTPMaxBytes: int64(httpMaxSize),
GCSTimeout: gcsTimeout,
GitTimeout: gitTimeout,
HgTimeout: hgTimeout,
S3Timeout: s3Timeout,
DecompressionLimitFileCount: *c.DecompressionFileCountLimit,
DecompressionLimitSize: int64(decompressionSizeLimit),
DisableArtifactInspection: *c.DisableArtifactInspection,
DisableFilesystemIsolation: *c.DisableFilesystemIsolation,View on GitHub (pinned to 482b49bf1a)
Solutions
- Correct s3_timeout to a valid Go duration such as "2m" or "120s"
- Verify the rendered agent config to ensure the value is non-empty and unit-suffixed
- Add time.ParseDuration validation in config-generation tooling to catch this before agent startup
Example fix
// before s3_timeout = "120" // after s3_timeout = "120s"
Defensive patterns
Strategy: validation
Validate before calling
if _, err := time.ParseDuration(*c.S3Timeout); err != nil {
return fmt.Errorf("invalid s3_timeout %q: %w", *c.S3Timeout, err)
} Type guard
func validDuration(s *string) bool { if s == nil { return false }; _, err := time.ParseDuration(*s); return err == nil } Try / catch
cfg, err := config.ArtifactConfigFromAgent(agentCfg)
if err != nil {
if strings.Contains(err.Error(), "error parsing S3Timeout") {
return fmt.Errorf("s3_timeout must be a Go duration like 2m: %w", err)
}
return err
} Prevention
- Include units in s3_timeout values ("2m", "120s")
- Catch empty env-injected values with a default before building config
- Run config validation as part of CI for generated agent configs
When it happens
Trigger: Calling ArtifactConfigFromAgent when S3Timeout is a bare number ("120"), unsupported unit ("2hrs"), empty string, or otherwise rejected by time.ParseDuration.
Common situations: s3_timeout misconfigured in the Nomad client artifact block; values injected from environment variables without units; templated configs where a variable failed to render, leaving an empty string.
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- error parsing HTTPMaxSize: %w
- error parsing GCSTimeout: %w
- error parsing GitTimeout: %w
- error parsing HgTimeout: %w
- error parsing HTTPReadTimeout: %w
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/319d20222a6dd8ee.
Report an issue: GitHub.