Problem
You are attempting to delete a user’s home folder using the Delete a workspace object (AWS | Azure | GCP) API when you get a “directory protected” error message.
{"error_code": "DIRECTORY_PROTECTED", "message": "Folder <user-email> is protected"}
Cause
Home folders are created by the system and cannot be modified as long as the user exists. This means they cannot be renamed, moved, deleted, etc. Trying to delete a home folder while the corresponding user exists in the workspace fails with an error.
Solution
An admin must remove the user from the workspace before attempting to delete the user’s home folder. Once a user is removed, the corresponding home folder becomes a modifiable folder and can be deleted by an admin.
Review the Manage users (AWS | Azure | GCP) documentation for information on removing users via the account console UI, workspace settings UI, or the API.
After the user has been deleted, you can delete the corresponding home folder using the workspace UI or by using the delete a workspace object API.