I made a bossbar to display the health of the nearest mob with the following command-
/execute store result bossbar name of bossbar value run data get @e[sort=nearest,limit=1,type=!player] Health
It works for some time then the bar empties. I try to add value to it manually ,it got added but did not show up.
It is resolved when I make the bar visibility to false and then make it visible again