hashicorp/packer · error
error initializing provisioner '%s': %s
Error message
error initializing provisioner '%s': %s
What it means
The provisioner plugin binary of the requested type was found and Packer attempted to launch it via PluginConfig.Provisioners.Start, but the plugin process failed to start or failed its handshake. Packer wraps the underlying plugin error with the provisioner type for context.
Source
Thrown at packer/core.go:256
if !c.components.PluginConfig.Provisioners.Has(rawP.Type) {
err := fmt.Errorf(
"The provisioner %s is unknown by Packer, and is likely part of a plugin that is not installed.\n"+
"You may find the needed plugin along with installation instructions documented on the Packer integrations page.\n\n"+
"https://developer.hashicorp.com/packer/integrations?filter=%s",
rawP.Type,
strings.Split(rawP.Type, "-")[0],
)
if sugg := didyoumean.NameSuggestion(rawP.Type, c.components.PluginConfig.Provisioners.List()); sugg != "" {
err = fmt.Errorf("Did you mean to use %q?", sugg)
}
return cbp, err
}
provisioner, err := c.components.PluginConfig.Provisioners.Start(rawP.Type)
if err != nil {
return cbp, fmt.Errorf(
"error initializing provisioner '%s': %s",
rawP.Type, err)
}
// Seems unlikely that a provisioner doesn't start successfully without error
if provisioner == nil {
return cbp, fmt.Errorf(
"provisioner failed to be started and did not error: %s", rawP.Type)
}
return c.generateCoreBuildProvisionerWithProvisioner(rawP, rawName, provisioner)
}
func (c *Core) generateCoreBuildProvisionerWithProvisioner(rawP *template.Provisioner, rawName string, provisioner packersdk.Provisioner) (CoreBuildProvisioner, error) {
cbp := CoreBuildProvisioner{}
// Get the configuration
config := make([]interface{}, 1, 2)
config[0] = rawP.ConfigView on GitHub (pinned to eb36e3c3e4)
Solutions
- Read the wrapped inner error and fix the root cause (reinstall the plugin: `packer plugins install github.com/hashicorp/<name>`).
- Verify the plugin binary exists and is executable in the plugin directory.
- Check Packer/plugin SDK version compatibility and upgrade the plugin if it was built against an old SDK.
- Run the plugin binary manually to see if it crashes at startup.
Example fix
# before $ packer build . # error initializing provisioner 'ansible': ... # after $ packer plugins install github.com/hashicorp/ansible $ packer build .
Defensive patterns
Strategy: try-catch
Validate before calling
// Verify the plugin binary can execute before building: // packer plugins installed && run `packer init` to repair missing installs
Try / catch
if _, err := core.Build(name); err != nil {
if strings.Contains(err.Error(), "error initializing provisioner") {
// remediate: reinstall plugin, check binary, then retry once
exec.Command("packer", "plugins", "install", pluginSource).Run()
}
return err
} Prevention
- Always `packer init` in CI before building.
- Pin plugin versions compatible with your Packer core version.
- Avoid hand-editing or pruning the plugin cache directory.
- Test plugin upgrades in a separate plugin path (PACKER_PLUGIN_PATH) first.
When it happens
Trigger: Provisioners.Start(rawP.Type) returns a non-nil error — e.g. the plugin binary exists in the registry entry but is missing/corrupt on disk, has wrong permissions, crashes at startup, or its protocol version is incompatible with the core. Raised from generateCoreBuildProvisioner during Core.Build.
Common situations: Upgraded Packer core with an old external plugin built against an incompatible SDK; plugin binary deleted or corrupted in the plugin directory; partially failed `packer plugins install`; OS refusing to exec the binary; plugin panicking during handshake.
Related errors
- error initializing builder '%s': %s
- Did you mean to use %q?
- provisioner failed to be started and did not error: %s
- error initializing post-processor '%s': %s
- source must be specified when auto_generate is not enabled
AI-assisted analysis of hashicorp/packer@eb36e3c3e4 (2026-09-05).
Data as JSON: /api/errors/8e87525c6a9cf03a.
Report an issue: GitHub.