{"record":{"id":"42767abfd6bfa069","repo":"hashicorp/packer","slug":"s-s","errorCode":null,"errorMessage":"%s: %s","messagePattern":"%s: %s","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"main.go","lineNumber":385,"sourceCode":"\tlog.Printf(\"[INFO] PACKER_CONFIG env var set; attempting to open config file: %s\", configFilePath)\n\tf, err := os.Open(configFilePath)\n\tif err != nil {\n\t\tif !os.IsNotExist(err) {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tlog.Printf(\"[WARN] Config file doesn't exist: %s\", configFilePath)\n\t\treturn &config, nil\n\t}\n\tdefer f.Close()\n\n\t// This loads a json config, defined in packer/config.go\n\tif err := decodeConfig(f, &config); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := config.LoadExternalComponentsFromConfig(); err != nil {\n\t\treturn nil, fmt.Errorf(\"%s: %s\", configFilePath, err)\n\t}\n\n\treturn &config, nil\n}\n\n// copyOutput uses output prefixes to determine whether data on stdout\n// should go to stdout or stderr. This is due to panicwrap using stderr\n// as the log and error channel.\nfunc copyOutput(r io.Reader, doneCh chan<- struct{}) {\n\tdefer close(doneCh)\n\n\tpr, err := prefixedio.NewReader(r)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tstderrR, err := pr.Prefix(ErrorPrefix)\n\tif err != nil {","sourceCodeStart":367,"sourceCodeEnd":403,"githubUrl":"https://github.com/hashicorp/packer/blob/eb36e3c3e48a036f3e8cc94087636ee72e1303c9/main.go#L367-L403","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before (shell)\npacker build template.json\n// after (shell)\npacker plugins install github.com/hashicorp/amazon\npacker build template.json","handlingStrategy":"validation","validationCode":"// Before running packer, verify required plugins are present:\n//   packer init .\n//   packer plugins installed\n// and confirm each type referenced in the config exists in the output.","typeGuard":null,"tryCatchPattern":"cfg, err := loadConfig(path)\nif err != nil {\n    // err is formatted as \"<configFilePath>: <cause>\" — split to inspect the cause\n    parts := strings.SplitN(err.Error(), \": \", 2)\n    return fmt.Errorf(\"config %s failed to load plugins: %v\", path, parts)\n}","preventionTips":["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"],"tags":["plugins","config-loading","cli"],"backgroundTag":"plugin-not-installed","analyzedSha":"eb36e3c3e48a036f3e8cc94087636ee72e1303c9","analyzedAt":"2026-09-05T13:20:43.127Z","contentChangedAt":"2026-09-05T13:20:43.127Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}