Thank you for posting in this community.
According to your description, I did a test on my side. Based on my tests, the limit of the characters (including the folder path and the file extent name) is 157 when saving a SharePoint Online Site as template. You can choose to reduce the length of the file url.
Note: the whole limited is around 260 characters since the prefix “https://tenantname.sharepoint.com/sites/sitename” that hidden in the error message.
If reducing the file url length is inconvenient or not what you are looking for, I would like to suggest you considering the following workaround to get rid of this limitation:
1.Save the site as template without the contents.
2.Copy your files from this site to your new sites by one of the following options:
- Copy the files to the new sites with the “Copy to” feature. By using this feature, the file histories will be reserved in the new sites.
- Open the document libraries in the file explorer and copy the files in the file explorer. In this way, the file history won’t be preserved, but this method is more convenient.
Please accept my sincere apologies for any inconvenience caused. If there is any other assistance I can provide, please feel free to let me know.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
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.