{"record":{"id":"f73d1e238d1ebd36","repo":"hashicorp/packer","slug":"post-processor-failed-s","errorCode":null,"errorMessage":"Post-processor failed: %s","messagePattern":"Post-processor failed: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packer/build.go","lineNumber":400,"sourceCode":"\t\t\t\tTarget: fmt.Sprintf(\"%s (%s)\", b.Name(), corePP.PType),\n\t\t\t\tUi:     originalUi,\n\t\t\t}\n\n\t\t\tif corePP.PName == corePP.PType {\n\t\t\t\tbuilderUi.Say(fmt.Sprintf(\"Running post-processor: %s\", corePP.PType))\n\t\t\t} else {\n\t\t\t\tbuilderUi.Say(fmt.Sprintf(\"Running post-processor: %s (type %s)\", corePP.PName, corePP.PType))\n\t\t\t}\n\t\t\tvar ts *TelemetrySpan\n\t\t\tif corePP.config != nil {\n\t\t\t\tts = CheckpointReporter.AddSpan(corePP.PType, \"post-processor\", corePP.config)\n\t\t\t} else {\n\t\t\t\tts = CheckpointReporter.AddSpan(corePP.PType, \"post-processor\", corePP.HCLConfig)\n\t\t\t}\n\t\t\tartifact, defaultKeep, forceOverride, err := corePP.PostProcessor.PostProcess(ctx, ppUi, priorArtifact)\n\t\t\tts.End(err)\n\t\t\tif err != nil {\n\t\t\t\terrors = append(errors, fmt.Errorf(\"Post-processor failed: %s\", err))\n\t\t\t\tcontinue PostProcessorRunSeqLoop\n\t\t\t}\n\n\t\t\tif artifact == nil {\n\t\t\t\tlog.Println(\"Nil artifact, halting post-processor chain.\")\n\t\t\t\tcontinue PostProcessorRunSeqLoop\n\t\t\t}\n\n\t\t\tkeep := defaultKeep\n\t\t\t// When user has not set keep_input_artifact\n\t\t\t// corePP.keepInputArtifact is nil.\n\t\t\t// In this case, use the keepDefault provided by the postprocessor.\n\t\t\t// When user _has_ set keep_input_artifact, go with that instead.\n\t\t\t// Exception: for postprocessors that will fail/become\n\t\t\t// useless if keep isn't true, heed forceOverride and keep the\n\t\t\t// input artifact regardless of user preference.\n\t\t\tif corePP.KeepInputArtifact != nil {\n\t\t\t\tif defaultKeep && *corePP.KeepInputArtifact == false && forceOverride {","sourceCodeStart":382,"sourceCodeEnd":418,"githubUrl":"https://github.com/hashicorp/packer/blob/eb36e3c3e48a036f3e8cc94087636ee72e1303c9/packer/build.go#L382-L418","documentation":"During CoreBuild.Run, each post-processor in the chain is executed via corePP.PostProcessor.PostProcess. If PostProcess returns an error, Run appends \"Post-processor failed: %s\" to the collected errors and continues with the next post-processor sequence (it does not abort the whole run immediately). The wrapped error names the underlying post-processor failure.","triggerScenarios":"Any post-processor's PostProcess(ctx, ui, priorArtifact) returning a non-nil error during a build run — e.g. artifact import failures, checksum mismatches, upload errors, or plugin crashes in the post-processor.","commonSituations":"vagrant-cloud/artifact upload failing on bad credentials; shell-local post-processor script exiting non-zero; compress post-processor failing on disk space; version mismatch between packer core and an installed post-processor plugin.","solutions":["Read the text after \"Post-processor failed:\" — it is the plugin's own error message identifying the root cause","Run with PACKER_LOG=1 to see the post-processor's detailed logs","Fix the underlying post-processor config (credentials, paths, script exit codes)","Re-run the build; the error was recorded but other post-processors in the sequence may still have run"],"exampleFix":"// before (HCL2)\npost-processor \"shell-local\" { script = \"./upload.sh\" }\n// after (HCL2) - make the script fail loudly with diagnostics and correct env\npost-processor \"shell-local\" {\n  env = { ARTIFACT_TOKEN = var.token }\n  script = \"./upload.sh\"\n  inline = [\"set -euo pipefail\"]\n}","handlingStrategy":"try-catch","validationCode":"// Pre-validate post-processor inputs before the build:\n// - check script files exist for shell-local\n// - verify credentials/variables referenced by the post-processor are set\ncode := `test -f ./upload.sh && test -n \"$ARTIFACT_TOKEN\"`","typeGuard":null,"tryCatchPattern":"artifacts, err := build.Run(ctx, ui)\nif err != nil {\n    var multi *packersdk.MultiError\n    if errors.As(err, &multi) {\n        for _, e := range multi.Errors {\n            if strings.HasPrefix(e.Error(), \"Post-processor failed:\") {\n                log.Printf(\"post-processor issue, continuing with partial artifacts: %v\", e)\n            }\n        }\n    }\n    return err\n}","preventionTips":["Test each post-processor standalone (with `packer inspect` or small templates) before full builds","Keep post-processor plugins at versions compatible with your packer core","Use PACKER_LOG=1 in CI to capture post-processor diagnostics","Make local scripts idempotent and exit 0 on already-done work"],"tags":["post-processor","build","plugin"],"backgroundTag":"post-processor-failed","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"}