If you encounter this error while try to install an SAP Agent (for me it occurred in a V12.2 system), then it is currently a reported bug. The problem is, that the SAP Agent is not accepting an SAP Connection Object, that was setup as "Group/Server Selection":
It looks like, when you save a CONN object directly with Group/Server Selection, some of the Custom Application Server entries (even if they are empty) are no longer a part of the CONN object definition, but the SAP Agent is checking for them anyway (like rfcHostname) and then fails to start.
If you look at the exported xml, the rfcHostname is indeed missing
If you need a workaround for Group/Server Selection until the bug is fixed, then there are 2 possible solutions:
Create a new object (it needs to be a new object) and save the object with empty custom application server first:
after that you can switch to the Group/Server Selection and specify the SAP parameters. This way the CONN object will be accepted by the SAP Agent. You can simply check that the rfcHostname is now part of the object definition, if you look at the xml file
If you do not wan't to create a new CONN object, then just simply export your object, edit the xml file and add these entries:
<component con="1" enc="0" type="2" value="" xmlName="rfcHostname"/>
<component con="1" enc="0" type="2" value="" xmlName="rfcSysnr"/>
import the xml back and the SAP Agent will accept the CONN object.