{"record":{"id":"98666d62940077b1","repo":"hashicorp/vagrant","slug":"exporting-an-smb-share-failed-details-about-the-f-98666d","errorCode":null,"errorMessage":"Exporting an SMB share failed! Details about the failure are shown\nbelow. Please inspect the error message and correct any problems.\n\nHost path: %{host}\n\nStderr: %{stderr}\n\nStdout: %{stdout}","messagePattern":"Exporting an SMB share failed! Details about the failure are shown\nbelow\\. Please inspect the error message and correct any problems\\.\n\nHost path: %(.+?)\n\nStderr: %(.+?)\n\nStdout: %(.+?)","errorType":"exception","errorClass":"VagrantPlugins::SyncedFolderSMB::Errors::DefineShareFailed","httpStatus":null,"severity":"error","filePath":"plugins/hosts/windows/cap/smb.rb","lineNumber":116,"sourceCode":"\n            shares << [\n              \"\\\"#{hostpath.gsub(\"/\", \"\\\\\")}\\\"\",\n              name,\n              data[:smb_id]\n            ]\n          end\n          if !shares.empty?\n            uac_notified = false\n            shares.each_slice(10) do |s_shares|\n              if !uac_notified\n                machine.env.ui.warn(\"\\n\" + I18n.t(\"vagrant_sf_smb.uac.create_warning\") + \"\\n\")\n                uac_notified = true\n                sleep(UAC_PROMPT_WAIT)\n              end\n              result = Vagrant::Util::PowerShell.execute(script_path, *s_shares, sudo: true)\n              if result.exit_code != 0\n                share_path = result.stdout.to_s.sub(\"share path: \", \"\")\n                raise SyncedFolderSMB::Errors::DefineShareFailed,\n                  host: share_path,\n                  stderr: result.stderr,\n                  stdout: result.stdout\n              end\n            end\n          end\n        end\n\n        # Generate a list of existing local smb shares\n        #\n        # @return [Hash]\n        def self.existing_shares\n          shares = get_smbshares || get_netshares\n          if shares.nil?\n            raise SyncedFolderSMB::Errors::SMBListFailed\n          end\n          @@logger.debug(\"local share listing: #{shares}\")\n          shares","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/hosts/windows/cap/smb.rb#L98-L134","documentation":"SyncedFolderSMB::Errors::DefineShareFailed raised at plugins/hosts/windows/cap/smb.rb:116 in smb_prepare. Shares are created in batches of 10 by invoking the elevated set_share.ps1 (`Vagrant::Util::PowerShell.execute(script_path, *s_shares, sudo: true)`) after a UAC warning; a non-zero exit raises with the failing host path extracted from stdout (\"share path: \" prefix stripped) plus stderr/stdout.","triggerScenarios":"`vagrant up`/`reload` with SMB folders on Windows where share creation fails: UAC elevation declined during the wait, host path invalid or inaccessible, Windows share-count/ACL limits hit, or the LanmanServer service stopped.","commonSituations":"UAC prompt dismissed or timing out; host_path on a nonexistent drive or a not-yet-mounted network path; group policy/AV blocking share creation; Server service disabled on tuned machines.","solutions":["Read Stderr — the underlying New-SmbShare/`net share` failure is printed there","Ensure the host path exists locally and your account may share it","Accept the UAC prompt, or run vagrant from an already-elevated shell","Start the Server service (`net start lanmanserver`) and `vagrant reload`"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# Every SMB host path must exist locally before vagrant creates shares\n[\"C:/path/to/share\"].each do |p|\n  abort \"SMB host path missing: #{p}\" unless File.directory?(p)\nend\n# and the Server service must run:\nsystem(\"net start lanmanserver >/dev/null 2>&1\") || abort \"Start the Server service\"","typeGuard":null,"tryCatchPattern":"begin\n  env.machine_action(:up)\nrescue VagrantPlugins::SyncedFolderSMB::Errors::DefineShareFailed => e\n  puts \"share creation failed for #{e.data[:host]}:\\n#{e.data[:stderr]}\"\n  # verify path/elevation, start lanmanserver, then retry\n  raise\nend","preventionTips":["Accept the UAC prompt (or run vagrant elevated) when the share-creation warning appears","Ensure host paths are local, existing directories on mounted drives","Keep the Server (lanmanserver) service enabled"],"tags":["smb","windows","share-creation","uac","synced-folders"],"backgroundTag":"smb-share-creation-failed","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}