hashicorp/nomad · error
reconcile option is invalid
Error message
reconcile option is invalid
What it means
The DisconnectStrategy.Reconcile field must be one of the known reconcile options (e.g. ReconcileOptionBestScore, ReconcileOptionKeepOriginal, ReconcileOptionKeepReplacement). Job.Validate wraps errInvalidReconcile with the offending value via fmt.Errorf("%w: %s") when the value is outside the accepted set. This guards against typo'd or unsupported reconcile strings.
Source
Thrown at nomad/structs/group.go:30
)
const (
// ReconcileOption is used to specify the behavior of the reconciliation process
// between the original allocations and the replacements when a previously
// disconnected client comes back online.
ReconcileOptionKeepOriginal = "keep_original"
ReconcileOptionKeepReplacement = "keep_replacement"
ReconcileOptionBestScore = "best_score"
ReconcileOptionLongestRunning = "longest_running"
)
var (
// Disconnect strategy validation errors
errStopAndLost = errors.New("Disconnect cannot be configured with both lost_after and stop_after")
errNegativeLostAfter = errors.New("lost_after cannot be a negative duration")
errNegativeStopAfter = errors.New("stop_after cannot be a negative duration")
errStopAfterNonService = errors.New("stop_after can only be used with service or batch job types")
errInvalidReconcile = errors.New("reconcile option is invalid")
)
func NewDefaultDisconnectStrategy() *DisconnectStrategy {
return &DisconnectStrategy{
Replace: new(true),
Reconcile: ReconcileOptionBestScore,
}
}
// Disconnect strategy defines how both clients and server should behave in case of
// disconnection between them.
type DisconnectStrategy struct {
// Defines for how long the server will consider the unresponsive node as
// disconnected but alive instead of lost.
LostAfter time.Duration `mapstructure:"lost_after" hcl:"lost_after,optional"`
// Defines for how long a disconnected client will keep its allocations running.
// This option has a different behavior for nil, the default, and time.Duration(0),View on GitHub (pinned to 482b49bf1a)
Solutions
- Set reconcile to a valid option: one of the documented constants (e.g. best_score, keep_original, keep_replacement)
- Read the wrapped message to see the invalid value supplied and correct the spelling/enum name
- Check the deployed Nomad version's supported reconcile options — newer options fail validation on older servers
- Omit the reconcile field entirely to get the default (ReconcileOptionBestScore)
Example fix
# before
job "web" {
type = "service"
disconnect {
reconcile = "keep-original" # invalid value
}
}
# after
job "web" {
type = "service"
disconnect {
reconcile = "keep_original"
}
} Defensive patterns
Strategy: validation
Validate before calling
var validReconcile = map[string]bool{"best_score": true, "keep_original": true, "keep_replacement": true}
if ds != nil && !validReconcile[ds.Reconcile] {
return fmt.Errorf("invalid reconcile option: %s", ds.Reconcile)
} Prevention
- Only use documented reconcile option constants
- Re-validate specs when upgrading Nomad versions
- Copy config snippets from version-matched docs
When it happens
Trigger: Job submission where disconnect.strategy reconcile = <value> is not one of the enumerated ReconcileOption constants; hit in Job.Validate's switch at group.go:95 default branch.
Common situations: Typos like reconcile = "keep-origional" or "best-score" vs the exact enum; copying config from docs of a newer Nomad version that added a reconcile option not present in the deployed binary.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- stop_after can only be used with service or batch job types
- ErrConnectRequireOneNetwork
- ErrConnectInvalidNetworkMode
- service.port must be set for mesh gateway service
- non-default Consul cluster requires Nomad Enterprise
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/915165074196a85c.
Report an issue: GitHub.