microsoft/garnet · error · ACLException
The special 'default' user cannot be removed from the system
Error message
The special 'default' user cannot be removed from the system
What it means
Thrown by AccessControlList.DeleteUserHandle when the username equals the constant 'default'. The default user is a protected, always-present account that grants bootstrap access, so it cannot be removed. Deletion of any other (non-existent) username simply returns false; only 'default' throws.
Source
Thrown at libs/server/ACL/AccessControlList.cs:101
// If a user with the given name already exists in the ACL, the new user cannot be added
if (!_userHandles.TryAdd(username, userHandle))
{
throw new ACLUserAlreadyExistsException(username);
}
}
/// <summary>
/// Deletes the <see cref="UserHandle"/> associated with the given username.
/// </summary>
/// <param name="username">Username of the user to delete.</param>
/// <returns>true if successful, false if no matching user was found.</returns>
/// <exception cref="ACLException">Thrown if the given user exists but cannot be deleted.</exception>
public bool DeleteUserHandle(string username)
{
if (username == DefaultUserName)
{
throw new ACLException("The special 'default' user cannot be removed from the system");
}
return _userHandles.TryRemove(username, out _);
}
/// <summary>
/// Remove all <see cref="UserHandle"/>s from the list.
/// </summary>
public void ClearUsers()
{
_userHandles.Clear();
}
/// <summary>
/// Return a list of all usernames and user objects.
/// </summary>
/// <returns>Dictionary of username/user pairs.</returns>
public IReadOnlyDictionary<string, UserHandle> GetUserHandles()
{View on GitHub (pinned to 951b0fc683)
Solutions
- Skip 'default' in any bulk-delete loop.
- Disable the default user (set it off / change its password) instead of deleting it if you need to restrict bootstrap access.
- Guard with a case-sensitive check username != "default" before calling DeleteUserHandle.
- Catch ACLException at the call site if deletion is best-effort.
Example fix
// before
acl.DeleteUserHandle(username);
// after
if (!string.Equals(username, "default", StringComparison.Ordinal))
acl.DeleteUserHandle(username); Defensive patterns
Strategy: validation
Validate before calling
if (string.Equals(username, "default", StringComparison.Ordinal))
throw new InvalidOperationException("The 'default' user cannot be deleted."); Type guard
static bool IsDeletable(string username) => !string.Equals(username, "default", StringComparison.Ordinal);
Try / catch
try { acl.DeleteUserHandle(username); }
catch (ACLException ex) when (ex.Message.Contains("default")) { /* skip protected default user */ } Prevention
- Exclude 'default' from bulk-delete loops.
- Disable/restrict the default user instead of deleting it.
- Guard with a case-sensitive 'default' check.
When it happens
Trigger: Calling DeleteUserHandle("default") explicitly, or an ACL management command (ACL DELUSER default) reaching this path. The comparison is case-sensitive against the literal 'default', so 'Default' would not throw (it would return false as not-found).
Common situations: A script that iterates all usernames and deletes them; a UI/CLI that offers delete on the default user; importing rules that attempt to redefine-then-delete default.
Related errors
- {username}
- ACL strict mode: {unresolved.Count} unresolved (user, custom
- Malformed ACL rule
- ACL rules need to start with the USER keyword
- {exception.Message}
AI-assisted analysis of microsoft/garnet@951b0fc683 (2026-08-13).
Data as JSON: /api/errors/b84bf14e1f4e48b6.
Report an issue: GitHub.