It seems there’s a mismatch in how the script is interacting with line items. In dynamic mode, line items are managed differently than in static mode. Make sure that when you’re working with sublist operations in SuiteScript, the record is loaded in the correct context according to the operation you’re performing. If you’re in dynamic mode, line operations must be handled in a certain sequence, which differs from static mode.