DOCTL: LB remove-droplets: Error: DELETE ... need to provide either a tag or a list of droplets

Posted April 30, 2021 225 views
Load BalancingDigitalOcean API and CLI (doctl)DigitalOcean Droplets


I am trying to remove one droplet with id 222 from Loadbalancer with lb_id=88-33-ff via doctl command as follow:

doctl compute load-balancer remove-droplets 88-33-ff --droplet-ids 222 

but i got the following error:

Error: DELETE 422 (request "xxx-xx-xxx-xxx-xxxx") need to provide either a tag or a list of droplets

is my command correct or i am missing something?
can anyone please help me and give a tip?

Note: here lb-id and droplet-id are fake, but the real one exist.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

I’ve run into the same problem using both the doctl CLI and the DigitalOcean API.

I’ve noticed that when droplets were individually added to the load balancer, they can be removed using doctl / API. However, when the droplets were added by tag, the remove-droplets operation fails.

The update a load balancer section of the API documentation states “it may contain one of the droplets_ids or tag attributes as they are mutually exclusive.” My guess is that either the CLI / API are not able to remove tag-based droplets, or that the required parameters are not published.

  • @bobbyiliev got the same problem with cURL request.

    @aluance : Thank you for your answer. yes, it can be that droplets were added by tag.

    Would it work if i remove the droplets from LB and add them again but individually and not by tag?


    • Hi there,

      I believe that @aluance has a very good point and it is worth giving it a try. Let us know how it goes!


    • Yes @phalcony, removing the tag from the LB and then adding the droplets back individually will work.

      We’ve opted to switch our approach so that we keep the LB tag constant and then tag / untag the desired droplets as needed.

      • @bobbyiliev/@aluance: Thank you for the help.

        I confirm that the problem was/is that the droplets were assign to LB automatically based on Tag, therefore remove-droplet based on dropletId/Tag is not working.
        I also can not remove a droplet manually from LB because of same reason (auto. assign by LB)

        But if you untag the desired droplet it will be removed the LB, and i can re-assign the droplet to LB by assigning the Tag.

        Remove droplet from LB:
        doctl compute droplet untag 222 --tag-name LIVE

        Add droplet to LB:
        doctl compute droplet tag 222 --tag-name LIVE

        MyTag: LIVE

Hi there,

I tried this with a fresh new Loadbalancer and a Droplet and it worked well with the following command:

doctl compute load-balancer remove-droplets lb-id-here-6123-4qs3-aab0 --droplet-ids 123456789

What is the version of your doctl command-line tool? I could suggest trying to upgrade it to the latest one and then test the command again.

Let me know how it goes.

  • Hi Bobby,

    Thank you for your answer.
    I am using quite updated version:

    doctl version
    doctl version 1.59.0-release
    Git commit hash: 833831a9


    • Hello,

      I think that this is the latest version.

      Can you add the -v flag so that you could get some more information when running the command? Feel free to share the output here.


      • Hi,

        Here is the output when i run the command with –trace –verbose flags:

        doctl: 2021/05/04 11:23:57 -> "DELETE /v2/load_balancers/88-33-ff/droplets HTTP/1.1\r\nHost:\r\nUser-Agent: doctl/1.59.0-release (linux amd64) godo/1.60.0\r\nContent-Length: 28\r\nAccept: application/json\r\nContent-Type: application/json\r\nAccept-Encoding: gzip\r\n\r\n{\"droplet_ids\":[222]}\n"
        doctl: 2021/05/04 11:23:57 <- "HTTP/2.0 422 Unprocessable Entity\r\nContent-Length: 145\r\nCf-Cache-Status: DYNAMIC\r\nCf-Ray: 64a0ac5aeb684a61-FRA\r\nCf-Request-Id: 00osk4a0cce00cf4a61b01fbcd0033301\r\nContent-Type: application/json; charset=utf-8\r\nDate: Tue, 04 May 2021 09:23:57 GMT\r\nExpect-Ct: max-age=604800, report-uri=\"\"\r\nRatelimit-Limit: 5000\r\nRatelimit-Remaining: 3945\r\nRatelimit-Reset: 3420930339\r\nServer: cloudflare\r\nSet-Cookie: __cfduid=xxxxx; expires=Thu, 03-Jun-21 09:23:57 GMT; path=/;; HttpOnly; SameSite=Lax\r\nX-Gateway: Edge-Gateway\r\nX-Request-Id: xx-xx-xx-xx-xxxx\r\nX-Response-From: service\r\n\r\n{\"id\":\"unprocessable_entity\",\"message\":\"need to provide either a tag or a list of droplets\",\"request_id\":\"xx-xx-xx-xx-xxxx\"}\n"
        Error: DELETE 422 (request "xx-xx-xx-xx-xxxx") need to provide either a tag or a list of droplets


        • Hi there,

          This is quite interesting. What I could suggest is verifying that the Droplet ID is correct with the following command:

          doctl compute droplet list

          Let me know how this goes.

          • Hi,

            The droplet ID is correct, as i in my question wrote the 222 is fake, but of course i pass the correct droplet id while trigger the remove-droplet command. Here in my last comment i just replaced in output the original lb-id and droplet-id with the fake ones before pasting here.


          • Hi there,

            Does the request work if you use curl instead? Also I could suggest trying to tag the Droplet and then try to use the tag instead of the Droplet Id.

            Let me know how it goes.