Go to 3DS System Settings -> Data Management -> Nintendo 3DS -> Software , let the console rebuild the database, then retry the installation.
Disclaimer: Installing CIAs requires custom firmware. Ensure you have the right to use the software and that you are using legal dumps of the update files. If you'd like, I can: pokemon ultra sun update 12 cia install
Ensure you have enough space on your SD card for the update (roughly 100MB+ for the update file and installation overhead). Go to 3DS System Settings -> Data Management