{"record":{"id":"f73d8511bddbd7ce","repo":"hashicorp/packer","slug":"no-communicator-found-for-provisioners-this-is-us","errorCode":null,"errorMessage":"No communicator found for provisioners! This is usually because the\n`communicator` config was set to \"none\". If you have any provisioners\nthen a communicator is required. Please fix this to continue.","messagePattern":"No communicator found for provisioners! This is usually because the\n`communicator` config was set to \"none\"\\. If you have any provisioners\nthen a communicator is required\\. Please fix this to continue\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packer/provisioner.go","lineNumber":123,"sourceCode":"\t\t\tif ok {\n\t\t\t\tcast[keyString] = val\n\t\t\t} else {\n\t\t\t\tlog.Printf(\"Error casting generated data key to a string.\")\n\t\t\t}\n\t\t}\n\t}\n\treturn cast\n}\n\n// Runs the provisioners in order.\nfunc (h *ProvisionHook) Run(ctx context.Context, name string, ui packersdk.Ui, comm packersdk.Communicator, data interface{}) error {\n\t// Shortcut\n\tif len(h.Provisioners) == 0 {\n\t\treturn nil\n\t}\n\n\tif comm == nil {\n\t\treturn fmt.Errorf(\n\t\t\t\"No communicator found for provisioners! This is usually because the\\n\" +\n\t\t\t\t\"`communicator` config was set to \\\"none\\\". If you have any provisioners\\n\" +\n\t\t\t\t\"then a communicator is required. Please fix this to continue.\")\n\t}\n\tfor _, p := range h.Provisioners {\n\t\tts := CheckpointReporter.AddSpan(p.TypeName, \"provisioner\", p.Config)\n\n\t\tcast := CastDataToMap(data)\n\t\terr := p.Provisioner.Provision(ctx, ui, comm, cast)\n\n\t\tts.End(err)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/hashicorp/packer/blob/eb36e3c3e48a036f3e8cc94087636ee72e1303c9/packer/provisioner.go#L105-L141","documentation":"The provisioner hook (Hook.Run) runs all provisioners for a build against a communicator. If comm is nil — meaning no communicator exists — but provisioners are registered, they could never run, so the hook returns this error explaining that `communicator: \"none\"` is incompatible with having provisioners.","triggerScenarios":"Calling ProvisionHook.Run (via packer/provisioner.go Hook.Run) with a nil communicator while h.Provisioners is non-empty; typically a build whose source sets `communicator = \"none\"` but still declares one or more `provisioner` blocks.","commonSituations":"Setting `communicator = \"none\"` on a builder/source to skip SSH/WinRM while forgetting to remove provisioner blocks; templates converted from builders that ignore the communicator setting; dynamically generated templates where provisioners are added unconditionally.","solutions":["Remove all provisioner blocks from the template, or","Change the source's `communicator` setting back to \"ssh\"/\"winrm\" and configure credentials.","Move provisioning logic into the builder's own scripts or into image-building stages outside Packer if no communicator is truly desired."],"exampleFix":"// before\nsource \"null\" \"example\" {\n  communicator = \"none\"\n}\nprovisioner \"shell\" { script = \"setup.sh\" } // error: no communicator\n// after (option 1)\nsource \"null\" \"example\" { communicator = \"none\" } // no provisioner blocks\n// after (option 2)\nsource \"null\" \"example\" {\n  communicator = \"ssh\"\n  ssh_username = \"admin\"\n}","handlingStrategy":"validation","validationCode":"// before hooking provisioners, ensure a communicator exists when needed\nif len(hook.Provisioners) > 0 && comm == nil {\n  return fmt.Errorf(\"provisioners declared but communicator is nil; check `communicator = \\\"none\\\"`\")\n}","typeGuard":null,"tryCatchPattern":"if err := hook.Run(ctx, ui, comm, data, hookData); err != nil {\n  if strings.Contains(err.Error(), \"No communicator found\") {\n    // drop provisioners or enable ssh/winrm communicator\n  }\n}","preventionTips":["Never combine `communicator = \"none\"` with provisioner blocks.","Validate templates (packer validate) before builds; this misconfig is caught there.","Review generated templates for unconditional provisioner blocks."],"tags":["provisioner","communicator","config"],"backgroundTag":"missing-communicator","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"}