ip_in_use
HTTP 409 IP address is attached to a server
What happened
The public IP address is attached to a server. You either asked to release it, asked to put it on a new interface while another server still holds it, or asked to move a router's external address onto it. It also answers when the address is free in GET /v1/ips but a running task is attaching it to a machine (a router move or a network interface change), and for up to an hour after a failed router move that left the router answering on it; the detail names the task.
What to do
Detach the address first, then repeat the same request. Two ways work for every interface of a server, net0 included, and restart a running server once (taking off only an extra, non-primary address of an interface does not restart it): PATCH /v1/servers/{id}/network-interfaces/{interface} with {"ips": []} takes the addresses off and leaves the interface in the public network, and with {"network_id": N} moves it to a private network. An interface other than net0 can also be deleted, and deleting the server holding the address detaches it too; net0, the interface the server was created with, cannot be deleted (interface_not_removable). A router's interfaces cannot be changed this way (409 router_interface_forbidden): its external address is replaced with PUT /v1/servers/{id}/router/wan-ip and leaves the router only when the router is deleted. Detaching happens at the end of the task that call returns, after the restart of a running server when there is one: until the task has finished, the address still belongs to the server and a release answers this same 409; once the task has succeeded the release goes through (GET /v1/ips shows server_id null once the address has left). A failed task leaves the address on the server. While a card task of that server runs, a release's 409 (DELETE /v1/ips/{id}) carries Retry-After and a detail naming the server and the task - wait for it, then repeat; an address that stays on the card gets the plain 409 again once the task is over. Deleting the server is refused too (server_busy) until the card task has finished.
Retrying
Change the state this refers to, then repeat the same request with the same idempotency key.
How it arrives
{
"type": "https://docs.fiberax.com/errors/ip_in_use",
"title": "IP address is attached to a server",
"status": 409,
"code": "ip_in_use",
"request_id": "a277dcd1ca652c65"
}
Branch your code on code, never on the wording of title.