Hard to undertand without seeing the code.
As a hypothesis, since the problem does not always occur and that the data is remote, I would say that you have not received the data, you have not waited for the complete "download" (httpjob, I guess).
You should eliminate the problem, not the message.
However, you could try to use the SQL Transactions to handle the error