"gam delete device" Fails with “Request contains an invalid argument” for Valid Device ID

140 views
Skip to first unread message

Bhuvan Daruwala

unread,
Apr 11, 2025, 6:44:26 AM4/11/25
to GAM for Google Workspace

Hi 
The gam delete device <DeviceEntity> command consistently fails with an INVALID_ARGUMENT error when using a valid Cloud Identity device ID in the correct syntax (devices/<UUID>). All authentication and token flows complete successfully, and the device ID matches the format output by gam print devices.


Steps to Reproduce
  1. Identified a device ID via:

    gam print devices fields deviceid

    Example device ID:

    3dbc03e6-6d12-4b52-a419-89230ac080d8
  2. Attempted deletion using:

    gam delete device "devices/3dbc03e6-6d12-4b52-a419-89230ac080d8" doit

    even tried
    gam delete device 3dbc03e6-6d12-4b52-a419-89230ac080d8
  3. Result:

    Device: devices/3dbc03e6-6d12-4b52-a419-89230ac080d8, Delete Failed: Request contains an invalid argument.

🔍 Debug Output (Summarized)
  • The OAuth token is issued successfully (200 OK).

  • The request to DELETE https://cloudidentity.googleapis.com/v1/devices/<device_id>?customer=customers/my_customer fails.

  • Response:

    { "error": { "code": 400, "message": "Request contains an invalid argument.", "status": "INVALID_ARGUMENT" } }

What I Have Confirmed
  • The deviceid exists in the output of gam print devices.

  • The format used is exactly as per DeviceID ::= devices/<String>.

  • The doit flag is used correctly.

  • The device is not a ChromeOS or mobile device — confirmed via gam print cros and gam print mobile.

  • Attempting gam info device "devices/<id>" results in the same INVALID_ARGUMENT error.


Open Questions
  • Are there scenarios where the deviceid from gam print devices may not be deletable through the gam delete device API path?

📌 Environment Info
  • GAM version: 7.06.01

  • Python version: 3.13.3

  • OS: macOS 15.4 (Apple Silicon)

  • Command issued with elevated debug_level = 4


Kindly assist as there are many devices which we want to bulk delete.

Thankyou

Ross Scroggs

unread,
Apr 11, 2025, 10:52:17 AM4/11/25
to google-ap...@googlegroups.com
This is working for me; send me a private Meet/Zoom invitation and we'll investigate.

Ross
----
Ross Scroggs



--
You received this message because you are subscribed to the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-apps-manager/0de1310f-179b-4afa-a3e2-2a2a96b3eb59n%40googlegroups.com.

Bhuvan Daruwala

unread,
Apr 14, 2025, 7:58:02 AM4/14/25
to GAM for Google Workspace
Hi Ross,
I have sent you an invite for today, lets investigate.

Thankyou
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.

Bhuvan Daruwala

unread,
Apr 14, 2025, 3:23:52 PM4/14/25
to GAM for Google Workspace
Hi Ross,
Thanks for getting on the call earlier today and helping in fixing the correct parameter that needs to be passed.

Working Steps 

  1. gam print devices > alldevicelist.csv
  2. Example device ID as per Google Admin Web console:

    3dbc03e6-6d12-4b52-a419-89230ac080d8
  3. From the CSV generated in Step1 locate the "name" field column for corresponding device ID (as per Step2)
    say for device ID above  the "name" column has value as "devices/EiQ0MWQxM2MxNy1c7867sewe569edew678cdc302qd4%3D"

  4. Attempted deletion using:

    gam delete device <<name>>

    eg: 
    gam delete device "devices/EiQ0MWQxM2MxNy1c7867sewe569edew678cdc302qd4%3D"

    The deleting should now be successful.

    Thanks
    Bhuvan Daruwala
Reply all
Reply to author
Forward
0 new messages