The process of building custom applications and tools that interact with Microsoft SharePoint, including SharePoint Online in Microsoft 365.
While the error does not indicate any permission-related issue, you should also double-check on that front. If running in the context of a user, make sure he's added as Site collection admin for the site in question. If running in the context of an app, verify that Files.ReadWrite.All is granted, as application permission, and consented to. Here's a recent thread where an issue with the same error was caused due to incorrect permissions: https://learn.microsoft.com/en-us/answers/questions/2261150/microsoft-graph-api-returns-generalexception-when