there are a few solutions to your problem. ( I post short answer in steps 1 - 4 and then i will give you long noob answer below)
1) you need to mount the XCI instead of installing it.
2) get an original cartridge XCI dump. (not an xci converterd from NSP)
3) allow unsigned code to be installed.
4) stop using that garbage tinfoil.
feel free to check out this thread. and install that NSP it has been tested and works fine for everyone here
https://ayakalounge.me/threads/anim...e-and-art-update-and-dlc-now-available.39786/
1) You seem to be installing the XCI instead of mounting it. if you go ahead and mount it you wont get invalid nca. how ever all updates for every game are NSP format you need to install those (unless you know how to compile them in a single file to mount. down side of that is that you will need to compile everysingle time a new update arrives to much work)
2) search for an original xci dump. goo luck with that
3)
tinfoil brags and sells you the idea they are protecting you from unsigned code: that is bull manure: you have more chances of softbricking your console from a Sx OS beta update than from a game. (its happened before)
Let me give you an example why you would get the error of unsigned code: when a game is patched to work on a lower version, when a game has been coverted from XCI to NSP, when an NSP has been converted to XCI, when tickets have been removed. when trying to install game on a lower firmware version than the games require.
In other words dont worry about the unsigned code its totally fine. what you need to worry about is unsigned malicious NSPs that brick your device from shady websites and torrents. lucky for us our main trusted uploader @African game uploads are 100% trusted and confirmed to work.
4) tinfoil is not the only installer. for example there is a great XCI, NSP, NSZ, XCZ installer that works with USB installation
You must click 'Like' before you can see the hidden data contained here
if you download any NSP or XCI from this website i can guarantee you they work 100 and its fine to installed unsigned. if you follow user African you will see that he will post a warning everytime there is a malicious NSP in the wild. example pokemon and dragon quest builders