Please follow below steps to troubleshooting the issue.
1.You should enable external sharing in both tenant level and site level.
(1)Tenant level: SharePoint admin center -> Policies -> Sharing -> Set the sharing policy.
(2)Site level: SharePoint admin center -> Sites -> Active sites -> Select the site -> Click “Sharing” tab -> Set the sharing policy.
2.If the site is office 365 group site, you need to enable the external sharing via PowerShell command for office 365 group site.
$adminUPN="user name"
$orgName="tenant name"
$usercredential = Get-Credential -username $adminUPN -Message "type password"
Connect-SPOService -Url https://$orgName-admin.sharepoint.com -Credential $userCredential
$siteurl="https://$orgName.sharepoint.com/sites/desired_site_collection
set-sposite -identity $siteurl -sharingcapability ExternalUserAndGuestSharing
3.If the site is SharePoint classis site, you need to go to office 365 admin center -> Resources -> Sites -> Select the site, check the Sharing Status.
4.Go to site settings -> Site permissions -> Access Request Settings, check if you have check the option “allow members to share the site and individual files and folders”.
5.Change external sharing settings according to this article.
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.