{"record":{"id":"618ab407e324b7e3","repo":"hashicorp/vagrant","slug":"failed-to-upload-a-file-to-the-guest-vm-via-scp-du","errorCode":null,"errorMessage":"Failed to upload a file to the guest VM via SCP due to a permissions\nerror. This is normally because the SSH user doesn't have permission\nto write to the destination location. Alternately, the user running\nVagrant on the host machine may not have permission to read the file.\n\nSource: %{from}\nDest: %{to}","messagePattern":"Failed to upload a file to the guest VM via SCP due to a permissions\nerror\\. This is normally because the SSH user doesn't have permission\nto write to the destination location\\. Alternately, the user running\nVagrant on the host machine may not have permission to read the file\\.\n\nSource: %(.+?)\nDest: %(.+?)","errorType":"exception","errorClass":"Vagrant::Errors::SCPPermissionDenied","httpStatus":null,"severity":"error","filePath":"plugins/communicators/ssh/communicator.rb","lineNumber":406,"sourceCode":"              upload_file = File.open(path, \"rb\")\n              begin\n                scp.upload!(upload_file, dest)\n              ensure\n                upload_file.close\n              end\n            end\n          end\n          uploader.call(from)\n        end\n      rescue RuntimeError => e\n        # Net::SCP raises a runtime error for this so the only way we have\n        # to really catch this exception is to check the message to see if\n        # it is something we care about. If it isn't, we re-raise.\n        raise if e.message !~ /Permission denied/\n\n        # Otherwise, it is a permission denied, so let's raise a proper\n        # exception\n        raise Vagrant::Errors::SCPPermissionDenied,\n          from: from.to_s,\n          to: to.to_s\n      end\n\n      def reset!\n        if @connection\n          @connection.close\n          @connection = nil\n        end\n        @ssh_info_notification = true # suppress ssh info output\n        wait_for_ready(5)\n      end\n\n      def generate_environment_export(env_key, env_value)\n        template = machine_config_ssh.export_command_template\n        template.sub(\"%ENV_KEY%\", env_key).sub(\"%ENV_VALUE%\", env_value) + \"\\n\"\n      end\n","sourceCodeStart":388,"sourceCodeEnd":424,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/communicators/ssh/communicator.rb#L388-L424","documentation":"Error \"Failed to upload a file to the guest VM via SCP due to a permissions\nerror. This is normally because the SSH user doesn't have permission\nto write to the destination location. Alternately, the user running\nVagrant on the host machine may not have permission to read the file.\n\nSource: %{from}\nDest: %{to}\" thrown in hashicorp/vagrant.","triggerScenarios":"Thrown at plugins/communicators/ssh/communicator.rb:406 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}