Export Block Descriptor Errors

There are multiple Flexy units running the same code and some of the units are having an issue with the export block descriptor call. They will error on the line where the ebd is called to open but once the basic script is stopped and then started again the code will run fine for a random amount of time. Below is a small part of each function code where the ebd is called. What could be causing these random errors and how can they be gracefully recovered from without having to restart the script? I do have backups from three unit that had the error if needed.

part a
startTime$=MQTT_LAST_HISTORY_DATE_TIME@
endTime$= @GetTimeForEBD$()

ebdHist$ = “exp:$dtHL $ftT $st” + startTime$ + " $et" + endTime$

jsonHistHeader$ = ’ {“HstryT”:{“ST”: “’+ startTime$ +’”,“ET”: “’+ endTime$ +’”} , “Unit”:{“ID”:"’+EownID$+’",“Name”:"’+DeviceId$+’"}, “HstryData”:[’
jsonHistFooter$ = ‘]}’

OPEN ebdHist$ FOR TEXT INPUT AS 1
A$ = Get 1
//PRINT A$
$Loop:

part b
// this will be current values for group A B C
ebdCurrent$ = “exp:$dtIV$ftT$flABC”
jsonCurrentHeader$ = ’ {“DeviceT”:{“DT”:"’+ @GetTime$() +’"} , “Unit”:{“ID”:"’+EownID$+’",“Name”:"’+DeviceId$+’"}, “CData”:[’
jsonCurrentFooter$ = ‘]}’
OPEN ebdCurrent$ FOR TEXT INPUT AS 1

part c
ebdAS$ = “exp:$dtAR $ftT $tsO”
jsonAS$ = ’ {“DT”:{“T”: “’+ @GetTime$() +’”} , “Unit”:{“ID”:"’+EownID$+’",“Name”:"’+DeviceId$+’"}, “AS”:[’
counter% =0
OPEN ebdAS$ FOR TEXT INPUT AS 1

part d
// start time would be the last ime the data uploaded successfully
startTime$=MQTT_LAST_HISTORY_DATE_TIME@
// end time would be now
endTime$= @GetTimeForEBD$()
ebdAH$ = “exp:$dtAH $ftT $st” + startTime$ + " $et" + endTime$
//ebdAH$ =“exp:$dtAH$st13022020_100000$et14022020_204000”

jsonAHHeader$ = ’ {“DT”:{“T”: “’+ @GetTime$() +’”} , “Unit”:{“ID”:"’+EownID$+’",“Name”:"’+DeviceId$+’"}, “AH”:[’
jsonAHFooter$ = ‘]}’

OPEN ebdAH$ FOR TEXT INPUT AS 1

A post was merged into an existing topic: Export Block Descriptor Error