{"record":{"id":"1ff10892ed38b656","repo":"hashicorp/vagrant","slug":"exporting-an-smb-share-failed-details-about-the-f","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/darwin/cap/smb.rb","lineNumber":107,"sourceCode":"            name = \"vgt-#{machine_id(machine)}-#{chksum_id}\"\n            data[:smb_id] ||= name\n\n            @@logger.info(\"creating new share name=#{name} id=#{data[:smb_id]}\")\n\n            cmd = [\n              \"/usr/bin/sudo\",\n              \"/usr/sbin/sharing\",\n              \"-a\", hostpath,\n              \"-S\", data[:smb_id],\n              \"-s\", \"001\",\n              \"-g\", \"000\",\n              \"-n\", name\n            ]\n\n            r = Vagrant::Util::Subprocess.execute(*cmd)\n\n            if r.exit_code != 0\n              raise VagrantPlugins::SyncedFolderSMB::Errors::DefineShareFailed,\n                host: hostpath.to_s,\n                stderr: r.stderr,\n                stdout: r.stdout\n            end\n          end\n        end\n\n        # Generates a unique identifier for the given machine\n        # based on the name, provider name, and working directory\n        # of the environment.\n        #\n        # @param [Vagrant::Machine] machine\n        # @return [String]\n        def self.machine_id(machine)\n          @@logger.debug(\"generating machine ID name=#{machine.name} cwd=#{machine.env.cwd}\")\n          Digest::MD5.hexdigest(\"#{machine.name}-#{machine.provider_name}-#{machine.env.cwd}\")\n        end\n      end","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/plugins/hosts/darwin/cap/smb.rb#L89-L125","documentation":"SyncedFolderSMB::Errors::DefineShareFailed raised at plugins/hosts/darwin/cap/smb.rb:107 in smb_export: each share is defined by running `sudo /usr/sbin/sharing -a <hostpath> -S <smb_id> -s 001 -g 000 -n <name>`; any non-zero exit raises with the host path plus the tool's stderr/stdout. The smb_id is a deterministic `vgt-<machine>-<md5>` name.","triggerScenarios":"Preparing SMB synced folders on macOS where the `sharing` tool refuses the definition: host path does not exist or is not a real absolute path, the share name/id collides with a stale definition, or file-sharing backend rejects the flags.","commonSituations":"host_path typo or on an unmounted external volume; path contains characters `sharing` rejects; a stale vgt-* share from a crashed run occupying the smb_id; SMB service half-disabled after an OS update.","solutions":["Check Stderr in the error — `sharing` prints its refusal reason there","Verify the Host path from the error exists and is readable (`ls <host path>`); remount the volume if needed","List existing definitions with `sharing -l` and remove stale/conflicting ones (`sudo sharing -r <name>`)","Fix the Vagrantfile path and `vagrant reload`"],"exampleFix":"# before — host path that does not exist\nconfig.vm.synced_folder \"/Volumes/Backup/data\", \"/data\", type: \"smb\"\n# after — real, mounted host path\nconfig.vm.synced_folder \"/Users/me/data\", \"/data\", type: \"smb\"","handlingStrategy":"validation","validationCode":"# Verify every SMB host path exists before vagrant defines shares\nDir.glob(\"*\").each { } # placeholder for load order\n[\"/Users/me/data\"].each do |p|\n  abort \"SMB host path missing: #{p}\" unless File.directory?(File.expand_path(p))\nend\n# and check for stale definitions: `sharing -l | grep vgt-`","typeGuard":null,"tryCatchPattern":"begin\n  env.machine_action(:up)\nrescue VagrantPlugins::SyncedFolderSMB::Errors::DefineShareFailed => e\n  puts \"share definition refused for #{e.data[:host]}:\\n#{e.data[:stderr]}\"\n  # check existence/permissions of host path, remove stale `sharing -l` entries, retry\n  raise\nend","preventionTips":["Keep SMB host paths on always-mounted volumes","Periodically clean stale vgt-* entries with `sudo sharing -r <name>`","Enable File Sharing before first use so `sharing` succeeds"],"tags":["smb","macos","sharing","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"}