Assuming the solar panels were installed on your primary residence, you can claim the energy tax credit in the tax year those solar panels were placed "in service" and started producing electricity. If that was in 2018, then you'll have to amend the 2018 tax return in order to claim the credit.