hashicorp/nomad · error

invalid artifact config: %v

Error message

invalid artifact config: %v

What it means

convertClientConfig derives the artifact settings via clientconfig.ArtifactConfigFromAgent from the client.artifact block. If that config is invalid (e.g. bad timeout values or HTTP options), the error is wrapped as 'invalid artifact config' and the agent fails to start or reload.

Source

Thrown at command/agent/agent.go:1146

		if ip.To4() != nil {
			return nil, fmt.Errorf("invalid bridge_network_subnet_ipv6: not an IPv6 address: %s", ipv6Subnet)
		}
		conf.BridgeNetworkAllocSubnetIPv6 = ipv6Subnet
	}
	conf.BridgeNetworkHairpinMode = agentConfig.Client.BridgeNetworkHairpinMode

	for _, hn := range agentConfig.Client.HostNetworks {
		conf.HostNetworks[hn.Name] = hn
	}
	conf.BindWildcardDefaultHostNetwork = agentConfig.Client.BindWildcardDefaultHostNetwork

	if agentConfig.Client.NomadServiceDiscovery != nil {
		conf.NomadServiceDiscovery = *agentConfig.Client.NomadServiceDiscovery
	}

	artifactConfig, err := clientconfig.ArtifactConfigFromAgent(agentConfig.Client.Artifact)
	if err != nil {
		return nil, fmt.Errorf("invalid artifact config: %v", err)
	}

	conf.Artifact = artifactConfig

	drainConfig, err := clientconfig.DrainConfigFromAgent(agentConfig.Client.Drain)
	if err != nil {
		return nil, fmt.Errorf("invalid drain_on_shutdown config: %v", err)
	}
	conf.Drain = drainConfig

	conf.Users = clientconfig.UsersConfigFromAgent(agentConfig.Client.Users)

	// Iterate the fingerprinter configs and populate the client mapping. The
	// validation function returns a suitable error that can be returned without
	// formatting.
	for _, fingerprinterCfg := range agentConfig.Client.Fingerprinters {
		if err := fingerprinterCfg.Validate(); err != nil {
			return nil, err

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Fix the client.artifact block: use valid duration strings like '30m'/'1h' for timeout fields and valid option values
  2. Read the wrapped %v detail in the log to identify the exact offending field
  3. Check the Nomad version's agent docs for allowed artifact options
  4. Test with `nomad agent -verify-only` before restarting the agent

Example fix

// before
client {
  artifact {
    http_rpc_timeout = "10"
  }
}
// after
client {
  artifact {
    http_rpc_timeout = "10m"
  }
}
Defensive patterns

Strategy: validation

Validate before calling

// Durations in the artifact block must parse as Go durations
if _, err := time.ParseDuration(artifactTimeout); err != nil {
    return fmt.Errorf("artifact timeout invalid: %w", err)
}

Prevention

When it happens

Trigger: An invalid client.artifact stanza in the agent config — e.g. timeout strings that fail time.ParseDuration, negative/zero invalid values, or structurally bad HTTP options — during agent start or handleReload.

Common situations: Setting artifact timeout without a unit ('10' instead of '10m'), unsupported option keys after a Nomad version upgrade added new validation, or template rendering producing bad values.

Related errors


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/7ec1476eac930b56. Report an issue: GitHub.