microsoft/garnet · error · AclCommandDoesNotExistException

{commandName}

Error message

{commandName}

What it means

Thrown by ACLParser.ApplyACLOpToUser when a '+<command>' or '-<command>' operation names a command that is neither a known built-in RespCommand (including subcommand 'CMD|SUB' and dotless module forms like 'RI.Create' -> 'RICREATE', plus SLAVEOF/CLUSTER|SET-CONFIG-EPOCH aliases) nor a valid custom command name (alphanumeric start, then alnum/._-| ). The offending command name is reported via AclCommandDoesNotExistException.

Source

Thrown at libs/server/ACL/ACLParser.cs:254

                        user.AddCommand(command);
                    }
                }
                else if (IsValidCustomCommandName(commandName))
                {
                    // Modules may not be loaded yet (ACL file is parsed before LoadModules), so we
                    // store the name on the user and resolve it later (startup pass, SETUSER, dispatch).
                    if (op[0] == '-')
                    {
                        user.RemoveCustomCommand(commandName);
                    }
                    else
                    {
                        user.AddCustomCommand(commandName);
                    }
                }
                else
                {
                    throw new AclCommandDoesNotExistException(commandName);
                }
            }
            else if (op.Equals("~*", StringComparison.Ordinal) || op.Equals("ALLKEYS", StringComparison.OrdinalIgnoreCase))
            {
                // NOTE: No-op, because only wildcard key patterns are currently supported. If per-key key
                // patterns are ever added, the GET scatter-gather fast path (NetworkGET_SG) must re-check
                // ACL per key: it serves GETs past the first without returning through the per-command ACL
                // check in ProcessMessages, which is only safe while key access is all-or-nothing.
            }
            else if (op.Equals("RESETKEYS", StringComparison.OrdinalIgnoreCase))
            {
                // NOTE: No-op, because only wildcard key patterns are currently supported
            }
            else
            {
                throw new ACLUnknownOperationException(op);
            }

View on GitHub (pinned to 951b0fc683)

Solutions

  1. Verify the command name is a real built-in or a legal custom/module name (alphanumeric first char).
  2. For module commands not yet loaded, ensure the name matches the LegalFirstChars/LegalRestChars rules so it is stored as custom and resolved later.
  3. Remove the leading '+/-' typo or stray characters.
  4. Confirm the command exists in this Garnet build (some Redis commands are not implemented).

Example fix

// before
ACLParser.ParseACLRule("user alice on +grt");

// after
ACLParser.ParseACLRule("user alice on +get");
Defensive patterns

Strategy: validation

Validate before calling

string name = op.Substring(1);
bool legalFirst = name.Length > 0 && (char.IsAsciiLetterOrDigit(name[0]));
bool legalRest = name.Skip(1).All(c => char.IsAsciiLetterOrDigit(c) || c=='.'||c=='_'||c=='-'||c=='|');
if (!legalFirst || !legalRest) throw new ArgumentException($"Illegal command name: {name}");

Type guard

static bool IsLegalCommandName(string name) =>
    name.Length > 0 && char.IsAsciiLetterOrDigit(name[0]) &&
    name.Skip(1).All(c => char.IsAsciiLetterOrDigit(c) || "._-|".Contains(c));

Try / catch

try { ACLParser.ParseACLRule(line, acl); }
catch (AclCommandDoesNotExistException ex) { logger.LogError("Unknown command: {Cmd}", ex.Message); }

Prevention

When it happens

Trigger: Referencing '+@' as a command (handled as category), typos like '+grt' instead of '+get', or a module command name with illegal leading characters (e.g. '+.foo' which fails the custom-name legality check).

Common situations: Typo in a command name; referencing a module command before the module is loaded AND the name is not a legal custom name; using uppercase/lowercase inconsistently (parsing is case-insensitive, so case alone won't trigger this); pasting a Redis command not implemented in Garnet.

Related errors


AI-assisted analysis of microsoft/garnet@951b0fc683 (2026-08-13). Data as JSON: /api/errors/54277d466158f68f. Report an issue: GitHub.