<err> fs: file open error (-12) when calling lv_img_set_src

Description

I have been calling lv_img_set_src to set an image from a file and it works very consistently. I just ran into a problem when testing that I get an error:

fs: file open error (-12)

This started happening and I had to reset the board to clear it. I’ve only run into it this one time but had to reset the board to get things running right again. I want to find out why it happened but also to identify the error when it’s happening. There is no return so how do I identify when it is happening?

What MCU/Processor/Board and compiler are you using?

nRF5340 DK

What LVGL version are you using?

8.3

What do you want to achieve?

Identify when the error is happening so I can take action or notify the user.

What have you tried so far?

No return code

The code block(s) should be formatted like:

    //set the file name of the image to dispalay
    LOG_DBG("Setting image from file: %s", file_name);
    lv_img_set_src(screen_token_icon, file_name);
    LOG_DBG("Image set");

Here is the log:
[00:11:07.598,876] screen_img: screen_img_load: Setting image from file: /lfs/icons/icon-87.bin
[00:11:07.598,907] fs: file open error (-12)
[00:11:07.598,968] screen_img: screen_img_load: Image set