Using a fairly generic CiviCRM contribution page with membership (CiviCRM 5.19.4 + Drupal 7) and CiviDiscount (3.7).
When a 100% discount code is used, instead of completing, the above error is returned from line 2500 of CRM/Contribute/Form/Contribution/Confirm.php, which is an api call.
The api call is to "completetransaction", with values:
[id] => 1550 [trxn_id] => [payment_processor_id] => 3 [is_transactional] => [fee_amount] => [receive_date] => [card_type_id] => [pan_truncation] => [version] => 3
Since the spec for this api call doesn't include entity_id, presumably this is cascading from a separate api call with the complete transaction.
The contribution is left as incomplete.