{"record":{"id":"ac51ad80e39fe67a","repo":"hashicorp/vagrant","slug":"there-was-an-error-while-attempting-to-run-the-pos","errorCode":null,"errorMessage":"There was an error while attempting to run the post rsync\ncommand for a synced folder. Please inspect the error message\nbelow for more info.\n\nHost path: %{hostpath}\nGuest path: %{guestpath}\nError: %{message}","messagePattern":"There was an error while attempting to run the post rsync\ncommand for a synced folder\\. Please inspect the error message\nbelow for more info\\.\n\nHost path: %(.+?)\nGuest path: %(.+?)\nError: %(.+?)","errorType":"exception","errorClass":"Vagrant::Errors::RSyncPostCommandError","httpStatus":null,"severity":"error","filePath":"plugins/synced_folders/rsync/helper.rb","lineNumber":236,"sourceCode":"          }\n        else\n          r = Vagrant::Util::Subprocess.execute(*(command + [command_opts]))\n        end\n\n        if r.exit_code != 0\n          raise Vagrant::Errors::RSyncError,\n            command: command.map(&:inspect).join(\" \"),\n            guestpath: guestpath,\n            hostpath: hostpath,\n            stderr: r.stderr\n        end\n\n        # If we have tasks to do after rsyncing, do those.\n        if machine.guest.capability?(:rsync_post)\n          begin\n            machine.guest.capability(:rsync_post, opts)\n          rescue Vagrant::Errors::VagrantError => err\n            raise Vagrant::Errors::RSyncPostCommandError,\n              guestpath: guestpath,\n              hostpath: hostpath,\n              message: err.to_s\n          end\n        end\n      ensure\n        FileUtils.remove_entry_secure(controlpath, true) if controlpath\n      end\n\n      # Check if rsync versions support using chown option\n      #\n      # @param [Vagrant::Machine] machine The remote machine\n      # @return [Boolean]\n      def self.rsync_chown_support?(machine)\n        if !RSYNC_CHOWN_REQUIREMENT.satisfied_by?(Gem::Version.new(local_rsync_version))\n          return false\n        end\n        mrv = machine_rsync_version(machine)","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/synced_folders/rsync/helper.rb#L218-L254","documentation":"After a successful rsync transfer, Vagrant runs the guest's rsync_post capability (typically chown -R on the synced directory). If that capability raises any VagrantError, the helper re-raises it as RSyncPostCommandError embedding the host/guest paths and the original error's message. The data transfer succeeded; the guest-side post step failed.","triggerScenarios":"rsync_post executing chown/chmod in the guest failing: mapped uid/gid not existing in the guest, read-only mount, full disk, SELinux/AppArmor denying ownership changes on the synced directory.","commonSituations":"Custom mount_options with wrong uid/gid; hardened guests with SELinux enforcing; guests with full disks; user 'vagrant' removed from the image.","solutions":["Follow the embedded message — it names the actual failing guest command (usually chown)","Ensure the uid/gid in mount_options (or the default vagrant user) exists inside the guest","Free disk space or relax SELinux/AppArmor in the guest if chown is denied","Override the rsync_post guest capability if you must customize post-transfer behavior"],"exampleFix":"# before\nconfig.vm.synced_folder \"src\", \"/app\", type: \"rsync\",\n  mount_options: [\"uid=9999\", \"gid=9999\"]   # ids absent in guest -> chown fails\n\n# after\nconfig.vm.synced_folder \"src\", \"/app\", type: \"rsync\",\n  mount_options: [\"uid=vagrant\", \"gid=vagrant\"]","handlingStrategy":"try-catch","validationCode":"# confirm the mapped identities exist before enabling rsync\nmachine.communicate.test(\"id -u vagrant >/dev/null 2>&1\") or raise \"guest lacks 'vagrant' user for rsync_post\"","typeGuard":null,"tryCatchPattern":"begin\n  machine.env.action_runner.run(rsync_action, env)\nrescue Vagrant::Errors::RSyncPostCommandError => e\n  # e.extra_data[:message] holds the original guest-side error (usually chown)\n  ui.error(\"post-rsync step failed: #{e.extra_data[:message]}\")\nend","preventionTips":["Use mount_options uid/gid values that exist in the guest image","Watch SELinux/AppArmor enforcement on synced directories","Keep guest disks from filling - chown fails on full/read-only filesystems"],"tags":["rsync","synced-folders","guest","permissions","post-command"],"backgroundTag":"post-sync-command-failed","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}