hashicorp/nomad · error
duplicate CNI arg %q
Error message
duplicate CNI arg %q
What it means
Raised during job validation when the same CNI argument key is declared in the cni_args of more than one network resource in the same group. Nomad merges all network resources' args into the single CNI_ARGS string, so duplicate keys are ambiguous and rejected.
Source
Thrown at nomad/structs/structs.go:7384
if port.To < -1 {
err := fmt.Errorf("Port %q cannot be mapped to negative value %d", port.Label, port.To)
mErr.Errors = append(mErr.Errors, err)
} else if port.To > math.MaxUint16 {
err := fmt.Errorf("Port %q cannot be mapped to a port (%d) greater than %d", port.Label, port.To, math.MaxUint16)
mErr.Errors = append(mErr.Errors, err)
}
if port.IgnoreCollision && !(net.Mode == "" || net.Mode == "host") {
err := fmt.Errorf("Port %q collision may not be ignored on non-host network mode %q", port.Label, net.Mode)
mErr.Errors = append(mErr.Errors, err)
}
}
// Validate the cniArgs in each network resource. Make sure there are no duplicate Args in
// different network resources or invalid characters (;) in key or value ;)
if net.CNI != nil {
for k, v := range net.CNI.Args {
if cniArgKeys.Contains(k) {
err := fmt.Errorf("duplicate CNI arg %q", k)
mErr.Errors = append(mErr.Errors, err)
} else {
cniArgKeys.Insert(k)
}
// CNI_ARGS is a ";"-separated string of "key=val", so a ";"
// in either key or val would confuse plugins (or libraries)
// that parse that string.
// Pre-validating this here protects job authors from submitting
// a job that will most likely error later on the client anyway.
if strings.Contains(k, ";") {
err := fmt.Errorf("invalid ';' character in CNI arg key %q", k)
mErr.Errors = append(mErr.Errors, err)
}
if strings.Contains(v, ";") {
err := fmt.Errorf("invalid ';' character in CNI arg value %q", v)
mErr.Errors = append(mErr.Errors, err)
}
}View on GitHub (pinned to 482b49bf1a)
Solutions
- Remove the duplicate key so each CNI arg appears in only one network resource
- Merge the arguments into a single network block's cni_args map
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at nomad/structs/structs.go:7384 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/3b0794d4da9cec90.
Report an issue: GitHub.