Since you have indicated that both the line items are same material code, not sure, how come for one line item, system is not throwing that error. Nevertheless, check this thread where similar topic was discussed.
No data exists for the given conditions
G. Lakshmipathi