I figured it out at the end. The problem was that the Function's client secret has expired silently in Microsoft Entra ID, and after renewing it and updating the Function configuration, things got back to normal.
The learning is that this error message can mean a lot of things, completely unrelated to what it says, and the golden rule with Azure Function troubleshooting is that you better double-triple check all the configuration/security settings before looking elsewhere.