hashicorp/packer · error
%s: %s
Error message
%s: %s
What it means
In main.go's config-loading path (decodeConfig of the JSON config in packer/config.go), if loading the external components (plugins) from the decoded config fails, the error is wrapped as "<configFilePath>: <err>". The message literally formats as "%s: %s" where the first %s is the template/config file path and the second is the underlying component-loading error.
Source
Thrown at main.go:385
log.Printf("[INFO] PACKER_CONFIG env var set; attempting to open config file: %s", configFilePath)
f, err := os.Open(configFilePath)
if err != nil {
if !os.IsNotExist(err) {
return nil, err
}
log.Printf("[WARN] Config file doesn't exist: %s", configFilePath)
return &config, nil
}
defer f.Close()
// This loads a json config, defined in packer/config.go
if err := decodeConfig(f, &config); err != nil {
return nil, err
}
if err := config.LoadExternalComponentsFromConfig(); err != nil {
return nil, fmt.Errorf("%s: %s", configFilePath, err)
}
return &config, nil
}
// copyOutput uses output prefixes to determine whether data on stdout
// should go to stdout or stderr. This is due to panicwrap using stderr
// as the log and error channel.
func copyOutput(r io.Reader, doneCh chan<- struct{}) {
defer close(doneCh)
pr, err := prefixedio.NewReader(r)
if err != nil {
panic(err)
}
stderrR, err := pr.Prefix(ErrorPrefix)
if err != nil {View on GitHub (pinned to eb36e3c3e4)
Solutions
- Install the missing plugin with `packer plugins install <source>` and verify it appears in the plugin directory
- Check the error after the file-path prefix — it names the component that failed to load
- Verify plugin binaries are executable and follow the naming convention (packer-plugin-<name>_vX.Y.Z)
- Validate the config file references only installed plugin types
Example fix
// before (shell) packer build template.json // after (shell) packer plugins install github.com/hashicorp/amazon packer build template.json
Defensive patterns
Strategy: validation
Validate before calling
// Before running packer, verify required plugins are present: // packer init . // packer plugins installed // and confirm each type referenced in the config exists in the output.
Try / catch
cfg, err := loadConfig(path)
if err != nil {
// err is formatted as "<configFilePath>: <cause>" — split to inspect the cause
parts := strings.SplitN(err.Error(), ": ", 2)
return fmt.Errorf("config %s failed to load plugins: %v", path, parts)
} Prevention
- Always run `packer init` after adding required_plugins or on fresh machines
- Keep plugin binaries executable and named per the packer-plugin convention
- Validate templates with `packer validate` before builds to catch missing components early
When it happens
Trigger: Running any packer command that loads a JSON config file (legacy template or packer config) where config.LoadExternalComponentsFromConfig fails — typically a plugin named in the config cannot be found or initialized.
Common situations: Required plugin binaries missing from the plugin directory or PATH; misnamed plugin files that don't match the packer-plugin naming convention; corrupted or non-executable plugin binaries; referencing a plugin type that isn't installed.
Related errors
AI-assisted analysis of hashicorp/packer@eb36e3c3e4 (2026-09-05).
Data as JSON: /api/errors/42767abfd6bfa069.
Report an issue: GitHub.