hashicorp/packer · error
This template requires Packer version
Error message
This template requires Packer version %s or higher; using %s
What it means
Packer templates may declare a `min_version` field. During `Core.validate()` (invoked via `initialize`), the running Packer binary's version is compared against that requirement using hashicorp/go-version. If the running version is strictly less than the declared minimum, template evaluation aborts with this error, because the template uses features or semantics that old binaries cannot safely handle.
Solutions
- Upgrade Packer to the version named in the error (`packer version` to check current, then install >= that minimum, e.g. via `packer` release binary, homebrew, or choco).
- If upgrading is impossible and you know the template does not actually need the newer features, lower or remove the `min_version`/`required_version` declaration in the template.
- Pin the CI/agent environment to a Packer version matching the template's `min_version` (e.g. setup-packer action with a version input).
Example fix
// before (template) "min_version": "1.12.0" // installed Packer is 1.9.5 // after (option A: upgrade binary) $ packer version -> Packer v1.12.0 // after (option B: relax requirement if features unused) "min_version": "1.9.0"
Defensive patterns
Strategy: validation
Validate before calling
// before running the build, compare versions
current, _ := version.NewVersion(packerVersion)
min, err := version.NewVersion("1.12.0")
if err != nil || current.LessThan(min) {
return fmt.Errorf("need Packer >= %s, have %s", min, current)
} Try / catch
// Go: check the returned error from Build/Initialize
if err := core.Initialize(); err != nil {
if strings.Contains(err.Error(), "requires Packer version") {
// fail fast with an upgrade instruction
return fmt.Errorf("upgrade Packer: %w", err)
}
return err
} Prevention
- Pin the Packer version in CI to match the template's min_version/required_version.
- Run `packer version` in your Makefile/setup script and bail early if below the required minimum.
- Keep `min_version` declarations as low as actually needed so old binaries aren't unnecessarily rejected.
When it happens
Trigger: A template (JSON `"min_version": "1.10.0"` or HCL2 `packer { required_version = ... }` path feeding Template.MinVersion) is parsed, `Core.validate()` runs `version.NewVersion(c.version)` vs `versionMin`, and `versionActual.LessThan(versionMin)` returns true — i.e. the binary executing `packer build`/`packer validate` is older than the declared minimum.
Common situations: Running an OS-package-manager Packer (often years old) against a template copied from newer docs; CI images pinning an outdated Packer; a colleague's template using newer HCL2 features while you run an old binary; forgetting to upgrade Packer after pulling a shared template repo.
Related errors
- invalid self-reported version
- required variable not set
- Bad source
- binary reported version
- Can only have 1 input file when not using tar/zip. Found
AI-assisted analysis of hashicorp/packer@eb36e3c3e4 (2026-09-05).
Data as JSON: /api/errors/fd2e2180af3d67ce.
Report an issue: GitHub.
Appendix: source
Thrown at packer/core.go:875
return err
}
// Validate the minimum version is satisfied
if c.Template.MinVersion != "" {
versionActual, err := version.NewVersion(c.version)
if err != nil {
// This shouldn't happen since we set it via the compiler
panic(err)
}
versionMin, err := version.NewVersion(c.Template.MinVersion)
if err != nil {
return fmt.Errorf(
"min_version is invalid: %s", err)
}
if versionActual.LessThan(versionMin) {
return fmt.Errorf(
"This template requires Packer version %s or higher; using %s",
versionMin,
versionActual)
}
}
// Validate variables are set
var err error
for n, v := range c.Template.Variables {
if v.Required {
if _, ok := c.variables[n]; !ok {
err = multierror.Append(err, fmt.Errorf(
"required variable not set: %s", n))
}
}
}
// TODO: validate all builders existView on GitHub (pinned to eb36e3c3e4)