{"record":{"id":"9b60c8bb043de20d","repo":"dotnet/orleans","slug":"service","errorCode":null,"errorMessage":"service","messagePattern":"service","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/AWS/Shared/Storage/DynamoDBStorage.cs","lineNumber":85,"sourceCode":"        /// <param name=\"readCapacityUnits\"></param>\n        /// <param name=\"writeCapacityUnits\"></param>\n        /// <param name=\"useProvisionedThroughput\"></param>\n        /// <param name=\"createIfNotExists\"></param>\n        /// <param name=\"updateIfExists\"></param>\n        public DynamoDBStorage(\n            ILogger logger,\n            string service,\n            string? accessKey = \"\",\n            string? secretKey = \"\",\n            string? token = \"\",\n            string? profileName = \"\",\n            int readCapacityUnits = DefaultReadCapacityUnits,\n            int writeCapacityUnits = DefaultWriteCapacityUnits,\n            bool useProvisionedThroughput = true,\n            bool createIfNotExists = true,\n            bool updateIfExists = true)\n        {\n            if (service == null) throw new ArgumentNullException(nameof(service));\n            this._accessKey = accessKey;\n            this.secretKey = secretKey;\n            this._token = token;\n            this._profileName = profileName;\n            this._service = service;\n            this._useProvisionedThroughput = useProvisionedThroughput;\n            this._provisionedThroughput = this._useProvisionedThroughput\n                ? new ProvisionedThroughput(readCapacityUnits, writeCapacityUnits)\n                : null;\n            this._createIfNotExists = createIfNotExists;\n            this._updateIfExists = updateIfExists;\n            _logger = logger;\n            CreateClient();\n        }\n\n        /// <summary>\n        /// Create a DynamoDB table if it doesn't exist\n        /// </summary>","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/dotnet/orleans/blob/fca799fa70ecb6ad975224271703ca43221f58de/src/AWS/Shared/Storage/DynamoDBStorage.cs#L67-L103","documentation":"Thrown by the DynamoDBStorage constructor when the service argument (the AWS region/service identifier, e.g. 'us-west-2') is null. The constructor uses nameof(service) so the thrown ArgumentNullException reports the parameter name 'service'. service drives RegionEndpoint selection in CreateClient, so a null value cannot proceed.","triggerScenarios":"Produced when constructing DynamoDBStorage (directly, or via a provider factory that passes options.Service) with service == null. Triggered by missing/empty 'Service' in DynamoDBStorageOptions / DynamoDBTransactionalStorageOptions / clustering/reminders options, or by a null being explicitly passed.","commonSituations":"Forgetting to set the 'Service' (region) property in configuration; reading the region from an environment variable/secret that resolved to null; misconfigured appsettings.json section; a test helper that constructs DynamoDBStorage without a region.","solutions":["Set the Service/Region in the DynamoDB options (the AWS region system name, e.g. 'us-west-2').","If the region comes from configuration/environment, validate it is non-null before building the silo.","Provide a sensible default in your bootstrap code (e.g., fallback to a known region).","Check the specific options section (clustering vs persistence vs reminders vs transactions) that corresponds to the failing provider."],"exampleFix":"// before: Service not set\nsilo.AddDynamoDBTransactionalGrainStorage(\"tx\", opt => { opt.TableName = \"tx\"; });\n\n// after: set the region\nsilo.AddDynamoDBTransactionalGrainStorage(\"tx\", opt =>\n{\n    opt.Service = Environment.GetEnvironmentVariable(\"AWS_REGION\") ?? \"us-west-2\";\n    opt.TableName = \"tx\";\n});","handlingStrategy":"validation","validationCode":"// Resolve and validate the region before building the silo\nvar region = Environment.GetEnvironmentVariable(\"AWS_REGION\")\n          ?? config[\"DynamoDB:Service\"]\n          ?? \"us-west-2\";\nif (string.IsNullOrWhiteSpace(region))\n    throw new InvalidOperationException(\"AWS region (Service) must be configured for DynamoDB storage\");","typeGuard":"static bool HasService(string? service) => !string.IsNullOrWhiteSpace(service);","tryCatchPattern":"try { silo.StartAsync(); }\ncatch (ArgumentNullException an) when (an.ParamName == \"service\")\n{\n    _logger.LogCritical(\"DynamoDB 'Service' (region) is null; set it in DynamoDBStorageOptions\");\n    throw;\n}","preventionTips":["Always set the Service (region) property in DynamoDB options.","Read region from a validated config/env source with a default fallback.","Unit-test config binding to ensure the DynamoDB section is populated.","Distinguish the region (Service) from credentials in config templates."],"tags":["dynamodb","null-argument","config","region"],"backgroundTag":null,"analyzedSha":"fca799fa70ecb6ad975224271703ca43221f58de","analyzedAt":"2026-08-13T19:55:57.938Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}