great, so it seems that the MIDI device is not ready by the time the program start. On 0.3.8b the USB MIDI driver is loaded before the Bela program starts, but maybe your device takes a few extra milliseconds to get initialised. If it's acceptable for the patch to start without the MIDI device connected, you could try:
[loadbang]
|
[delay 2000]
|
[hw 1 0 0(
|
[s bela_setMidi]
If the patch has to start with MIDI already enabled, you could instead modify /opt/Bela/bela_startup.sh
and add at the second line:
sleep 2
(which adds a delay of 2 seconds).
In both cases, if this works you can then try to reduce the delay time if you require a faster startup.