I've seen Disk Utility have issues when erasing a drive before (don't recall the exact error number or message). When it happened, I tried erasing the drive a second time immediately after the failure....the second attempt succeeded. If repeated attempts fail to erase the drive, then maybe there is a hardware issue with that drive (possibly a cable issue, port issue, adapter issue, drive enclosure issue, or the SSD itself is bad).
Just make sure you are selecting the whole physical drive to erase. Within Disk Utility you may need to click "View" and select "Show All Devices" before the physical drives appear on the left pane of Disk Utility. Sometimes you may want to try a different file system to see if that makes any difference.
And what command are you using in the Terminal to erase the SSD? Keep in mind performing a secure erase by writing zeroes or random data is not good for the SSD and it doesn't exactly erase an SSD like you would expect since SSDs work differently than older style platter hard drives.
You can try checking the health of the external SSD by running DriveDx (free trial period) and posting the complete text report here using the "Additional Text" icon which looks like a piece of paper. You will need to install a special USB driver in order to attempt to access the external SSD's health information. Even with the special USB driver, the drive enclosure may still prevent access to the SSD's health information.