I can do anything to my file when calling it anywhere during the setup. But whenever I try to open it to append some data, inside the loop and after receiveing a mqtt message, I get and error such as the one shown in the image below:
During the setup, I open the file, read it, and then flush and close. Then while the board is running, any time a new mqtt message arrives, I try to write it to the sd card. Again, I open the file in append mode, write, flush and close. But it does not work!
Here is the source code if you want to take a look.
https://github.com/AllanOricil/esp32-mfa-totp-generator/tree/feature/ease-adding-new-secrets
UPDATE:
I discovered that if I disable the screen I can finally use sd card operations in the loop
@rzeldent do you know why I cant use the screen and the sd card together?

UPDATE 2:
I isolated the problem to lvgl. Im now sure that after starting the UI, i can no longer interact with the SD card
