Can't deregister service with name "http://host:port/"

Hello All,
I made a mistake during registration of my service and it looks like stf_app: now
I need to remove it, but neither consul services deregister, nor API, nor ansible consul module (which was used for registration) do not work:

  • consul services deregister --token=123 -id=stf_app: : Error registering service “”: Unexpected response code: 405 (method GET not allowed)
  • ansible playbook: msg: 500 Unknown service {“stf_app:http:/” {}}
  • curl --request PUT --data @deregister_stf.json ( { "Datacenter": "dc1", "ServiceID": "stf_app", "Node": "" } ) : rpc error making call: Unknown service ‘stf_app’

There is some magic how Consul replaces http:// to http:/ in my case and this happens only if I put :3100/ at the end.

I’ve checked similar topics on the net, but nothing seems to be related to my case.

Does anyone have a clue how to fix this? Appreciate any help.

Hi @vyakovlev-hw,

Could you check that the ID in the output of curl http://localhost:8500/v1/agent/service/stf_app (when queried from matches the ID of the service that you’re trying to de-register?

If not, try the de-registration with the ID returned from the command. It should successfully remove the service.

Hello @blake, thanks for proposed solution and sorry for the late response.
Unfortunately, it doesn’t work.

$ curl http://localhost:8500/v1/agent/service/stf_app
unknown service ID: stf_app

$ curl --request GET | python -m json.tool | grep ‘stf_app’ -A1 -B1
“serviceA”: ,
“stf_app”: ,
“serviceB”: [

$ cat deregister_stf.json
“Datacenter”: “dc1”,
“ServiceID”: “stf_app”,
“Node”: “

$ curl --request PUT --data @deregister_stf.json
rpc error making call: Unknown service ‘stf_app’

Probably, I’m doing something wrong? Appreciate any help.

I still can’t find a solution for this and have no ideas.
Maybe anyone else has a clue what’s wrong?

Maybe anyone else has a clue.
This issue seems to be odd and I’m confused if it is something that needs to be addressed in Consul itself or a well-known case that has a workaround?

Hi @vyakovlev-hw,

Apologies for the very delayed reply. I just wanted to share an update on this.

I believe the issue you reported will be fixed in the next release of Consul, 1.11.2. The API has been changed in that release to allow de-registration of services that have a / in the name (among other things).