{"record":{"id":"616dc92ddf1206be","repo":"microsoft/garnet","slug":"acl-configuration-file-not-set","errorCode":null,"errorMessage":"ACL configuration file not set.","messagePattern":"ACL configuration file not set\\.","errorType":"exception","errorClass":"ACLException","httpStatus":null,"severity":"error","filePath":"libs/server/ACL/AccessControlList.cs","lineNumber":225,"sourceCode":"                streamReader.Close();\n            }\n\n            // Add back default user and update the cached default user handle\n            _defaultUserHandle = acl.CreateDefaultUserHandle(defaultPassword);\n\n            // Atomically replace the user list\n            _userHandles = acl._userHandles;\n        }\n\n        /// <summary>\n        /// Save current\n        /// </summary>\n        /// <param name=\"aclConfigurationFile\"></param>\n        public void Save(string aclConfigurationFile)\n        {\n            if (string.IsNullOrEmpty(aclConfigurationFile))\n            {\n                throw new ACLException($\"ACL configuration file not set.\");\n            }\n\n            // Lock to ensure one flush at a time\n            lock (this)\n            {\n                StreamWriter streamWriter = null;\n                try\n                {\n                    // Initialize so as to allow the streamwriter buffer to fill in memory and do a manual flush afterwards\n                    streamWriter = new StreamWriter(path: aclConfigurationFile, append: false, encoding: Encoding.UTF8, bufferSize: 1 << 16)\n                    {\n                        AutoFlush = false\n                    };\n\n                    // Write lines into buffer\n                    foreach (var userHandle in _userHandles)\n                        streamWriter.WriteLine(userHandle.Value.User.DescribeUser());\n","sourceCodeStart":207,"sourceCodeEnd":243,"githubUrl":"https://github.com/microsoft/garnet/blob/951b0fc6838721f89d102c2bbe1b914e8d39d700/libs/server/ACL/AccessControlList.cs#L207-L243","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Ensure the ACL configuration file path is resolved from server options before calling Save().","Add a startup assertion or validation that ACLConfigurationFile is non-empty when ACL persistence is enabled.","If Save() is called programmatically, default the path from the same option used by Load()."],"exampleFix":"// before\nacl.Save(aclConfigurationFile); // may be null/empty\n\n// after\nif (string.IsNullOrEmpty(aclConfigurationFile))\n    throw new InvalidOperationException(\"ACL file path must be configured before saving.\");\nacl.Save(aclConfigurationFile);","handlingStrategy":"validation","validationCode":"if (string.IsNullOrEmpty(aclConfigurationFile))\n    throw new InvalidOperationException(\"ACL configuration file path is not set; cannot save.\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Resolve the ACL file path from server options at startup and assert it is non-empty when ACL persistence is on.","Never call Save() with an unvalidated path variable.","Unit-test the config-loading path to ensure ACLConfigurationFile is populated."],"tags":["acl","config","validation","programming-error"],"backgroundTag":null,"analyzedSha":"951b0fc6838721f89d102c2bbe1b914e8d39d700","analyzedAt":"2026-08-13T19:01:32.939Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}