When deselecting - "Enable gift aid for line items of any financial type" , adding a contribution via the API causes financialTypeIsEligible($financialType) in SetContributionGiftAidEligibility.php to throw "explode() expects parameter 2 to be string, array given" on the line
$eligibleFinancialTypes = explode(',', CRM_Civigiftaid_Settings::getValue('financial_types_enabled'));
Removing the explode seems to handle both ticked and unticked cases.