Network proxy setup in terminal
You need to delete the proxy password programmatically, something like - 

security delete-internet-password -s $PROXY
networksetup -setwebproxy Ethernet $PROXY 8080 on $USER $PASSWORD


Here, the -s tells it to delete the internet password that has the server set as proxy.example.com

Once it's deleted you can recreate the web proxy entries.

If you want to find the passwords to test before deleting, you can do the following, and confirm you get only one entry. You can also set a comment (use KeyChain Access), and confirm it shows up in the icmt field:

security find-internet-password -s 'proxy.example.com'
keychain: "/Users/alex/Library/Keychains/login.keychain-db"
version: 512
class: "inet"
attributes:
0x00000007 &lt;blob&gt;="proxy.example.com"
0x00000008 &lt;blob&gt;=&lt;NULL&gt;
"acct"&lt;blob&gt;="username"
"atyp"&lt;blob&gt;=&lt;NULL&gt;
"cdat"&lt;timedate&gt;=0x32303139303231383032343431305A00  "20190218024410Z\000"
"crtr"&lt;uint32&gt;=&lt;NULL&gt;
"cusi"&lt;sint32&gt;=&lt;NULL&gt;
"desc"&lt;blob&gt;=&lt;NULL&gt;
"icmt"&lt;blob&gt;=&lt;NULL&gt;
"invi"&lt;sint32&gt;=&lt;NULL&gt;
"mdat"&lt;timedate&gt;=0x32303139303231383032343632395A00  "20190218024629Z\000"
"nega"&lt;sint32&gt;=&lt;NULL&gt;
"path"&lt;blob&gt;=&lt;NULL&gt;
"port"&lt;uint32&gt;=0x00001F90
"prot"&lt;blob&gt;=&lt;NULL&gt;
"ptcl"&lt;uint32&gt;="htpx"
"scrp"&lt;sint32&gt;=&lt;NULL&gt;
"sdmn"&lt;blob&gt;=&lt;NULL&gt;
"srvr"&lt;blob&gt;="proxy.example.com"
"type"&lt;uint32&gt;=&lt;NULL&gt;