microsoft/garnet · error · ACLException

ACL configuration file not set.

Error message

ACL configuration file not set.

What it means

Thrown by AccessControlList.Save() when the aclConfigurationFile argument is null or empty. Save() has no way to determine the target file path, so it fails immediately before attempting any I/O. This is a programmer/contract error, not a runtime or data condition.

Source

Thrown at libs/server/ACL/AccessControlList.cs:225

                streamReader.Close();
            }

            // Add back default user and update the cached default user handle
            _defaultUserHandle = acl.CreateDefaultUserHandle(defaultPassword);

            // Atomically replace the user list
            _userHandles = acl._userHandles;
        }

        /// <summary>
        /// Save current
        /// </summary>
        /// <param name="aclConfigurationFile"></param>
        public void Save(string aclConfigurationFile)
        {
            if (string.IsNullOrEmpty(aclConfigurationFile))
            {
                throw new ACLException($"ACL configuration file not set.");
            }

            // Lock to ensure one flush at a time
            lock (this)
            {
                StreamWriter streamWriter = null;
                try
                {
                    // Initialize so as to allow the streamwriter buffer to fill in memory and do a manual flush afterwards
                    streamWriter = new StreamWriter(path: aclConfigurationFile, append: false, encoding: Encoding.UTF8, bufferSize: 1 << 16)
                    {
                        AutoFlush = false
                    };

                    // Write lines into buffer
                    foreach (var userHandle in _userHandles)
                        streamWriter.WriteLine(userHandle.Value.User.DescribeUser());

View on GitHub (pinned to 951b0fc683)

Solutions

  1. Ensure the ACL configuration file path is resolved from server options before calling Save().
  2. Add a startup assertion or validation that ACLConfigurationFile is non-empty when ACL persistence is enabled.
  3. If Save() is called programmatically, default the path from the same option used by Load().

Example fix

// before
acl.Save(aclConfigurationFile); // may be null/empty

// after
if (string.IsNullOrEmpty(aclConfigurationFile))
    throw new InvalidOperationException("ACL file path must be configured before saving.");
acl.Save(aclConfigurationFile);
Defensive patterns

Strategy: validation

Validate before calling

if (string.IsNullOrEmpty(aclConfigurationFile))
    throw new InvalidOperationException("ACL configuration file path is not set; cannot save.");

Prevention

When it happens

Trigger: Calling acl.Save(null), acl.Save(""), or acl.Save(aclConfigurationFile) where the variable was never populated (e.g. the server option ACLConfigurationFile was not set in command-line args or config).

Common situations: Running Garnet with ACL enabled in code but forgetting to pass --acl-file; calling Save() from a management tool without resolving the file path first; a config loading bug that produces an empty string.

Related errors


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