It sounds as though you have a lost or corrupt, "
/efs file".
If you followed best practice when rooting or flashing ROMs and made nandroid backups prior to flashing, then you can restore that and it will replace/restore your, "
/efs", file. See,
#3.2 &
#3.3 of
[International] Rooting Galaxy S4 - Dummies Guide
Alternatively, if you use a custom recovery and made a backup in the past, most will save a copy of this all important, "
/efs", file to storage on your phone somewhere.
How to Backup and Restore EFS / IMEI on Samsung Galaxy Devices – Did You Do It?
If you do not have a backup you can try the method described here..
[GUIDE] Recover your IMEI in 9 steps.