delete a workspace from cli fails when it was created on behalf of another user

To manage a workshop, I wrote some script to create and delete the proper number of users and workspaces.
I had no issue to create the workspace on behalf of each user like this:
echo "Please input the number of users you want to create:"
read number

for ((i=0; i<number; i++))
do
    coder users create --username user$i --password Password$i --email email$i@email.com --login-type password
    coder create user$i/workspace$i -t AI-101-endpoints -y
done

in the end I have X users with an associated workspace.
Now I plan my work after the workshop and so I wrote the equivalent script to remove those users and workspaces.
echo "Please input the number of users you want to delete:"
read number

for ((i=0; i<number; i++))
do
    coder delete workspace$i -y
    coder users delete user$i
done

But the command to delete a workspace fails with the error:
Encountered an error running "coder delete", see "coder delete --help" for more information
error: Resource not found or you do not have access to this resource
FAIL


Did I miss something?

side note: why having a different syntax for workspace and not as the others coder <resource> <subcommand>?
Was this page helpful?