{"record":{"id":"ee08b87cccdbf1ad","repo":"dotnet/orleans","slug":"value-cannot-be-null-parameter-sharedkeycredent","errorCode":null,"errorMessage":"Value cannot be null. (Parameter 'sharedKeyCredential')","messagePattern":"Value cannot be null\\. \\(Parameter 'sharedKeyCredential'\\)","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Azure/Shared/Storage/AzureStorageOperationOptions.cs","lineNumber":156,"sourceCode":"        {\n            if (serviceUri is null) throw new ArgumentNullException(nameof(serviceUri));\n            if (tokenCredential is null) throw new ArgumentNullException(nameof(tokenCredential));\n            _tableServiceClient = null;\n            CreateClient = () => Task.FromResult(new TableServiceClient(serviceUri, tokenCredential, GetTableClientOptions()));\n        }\n\n        internal void SetTableServiceClient(Uri serviceUri, AzureSasCredential azureSasCredential)\n        {\n            if (serviceUri is null) throw new ArgumentNullException(nameof(serviceUri));\n            if (azureSasCredential is null) throw new ArgumentNullException(nameof(azureSasCredential));\n            _tableServiceClient = null;\n            CreateClient = () => Task.FromResult(new TableServiceClient(serviceUri, azureSasCredential, GetTableClientOptions()));\n        }\n\n        internal void SetTableServiceClient(Uri serviceUri, TableSharedKeyCredential sharedKeyCredential)\n        {\n            if (serviceUri is null) throw new ArgumentNullException(nameof(serviceUri));\n            if (sharedKeyCredential is null) throw new ArgumentNullException(nameof(sharedKeyCredential));\n            _tableServiceClient = null;\n            CreateClient = () => Task.FromResult(new TableServiceClient(serviceUri, sharedKeyCredential, GetTableClientOptions()));\n        }\n\n        internal TableClientOptions GetTableClientOptions()\n        {\n            var clientOptions = ClientOptions ??= new TableClientOptions();\n            ConfigureRetryOptions(clientOptions.Retry, StoragePolicyOptions);\n            return clientOptions;\n        }\n\n        private static void ConfigureRetryOptions(RetryOptions retryOptions, AzureStoragePolicyOptions storagePolicyOptions)\n        {\n            // Keep this aligned with AzureStoragePolicyOptions defaults, which mirror Azure Storage SDK retry settings.\n            var delay = storagePolicyOptions.PauseBetweenOperationRetries > TimeSpan.Zero\n                ? storagePolicyOptions.PauseBetweenOperationRetries\n                : TimeSpan.FromSeconds(0.8);\n","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/dotnet/orleans/blob/fca799fa70ecb6ad975224271703ca43221f58de/src/Azure/Shared/Storage/AzureStorageOperationOptions.cs#L138-L174","documentation":"Thrown by AzureStorageOperationOptions.SetTableServiceClient(Uri, TableSharedKeyCredential) when the TableSharedKeyCredential is null. The shared-key credential carries the account name and key; without it the SDK cannot sign requests.","triggerScenarios":"Calling ConfigureTableServiceClient(uri, sharedKey) with a valid uri but a null TableSharedKeyCredential — usually the account key was not loaded.","commonSituations":"Account key missing from secrets; key rotation code path producing null; misnamed config key for the storage account name/key.","solutions":["Construct a non-null TableSharedKeyCredential from the account name and key, or set TableServiceClient directly.","Load the key from the secret store and validate presence.","Prefer constructing the client yourself."],"exampleFix":"// before\noptions.ConfigureTableServiceClient(uri, sharedKeyCred); // sharedKeyCred null\n// after\nvar name = config[\"AccountName\"] ?? throw new InvalidOperationException(\"Missing AccountName\");\nvar key  = secrets[\"AccountKey\"]  ?? throw new InvalidOperationException(\"Missing AccountKey\");\noptions.TableServiceClient = new TableServiceClient(uri, new TableSharedKeyCredential(name, key));","handlingStrategy":"validation","validationCode":"var name = config[\"AccountName\"] ?? throw new InvalidOperationException(\"Missing AccountName\");\nvar key  = secrets[\"AccountKey\"]  ?? throw new InvalidOperationException(\"Missing AccountKey\");\noptions.TableServiceClient = new TableServiceClient(serviceUri, new TableSharedKeyCredential(name, key));","typeGuard":"static bool HasSharedKey(TableSharedKeyCredential? c) => c is not null;","tryCatchPattern":"catch (ArgumentNullException ex) when (ex.ParamName == \"sharedKeyCredential\") { /* load account name/key from secrets */ }","preventionTips":["Keep storage keys in the secret store.","Handle key rotation so construction never yields null."],"tags":["orleans","azure-storage","azure-table","configuration","shared-key","argument"],"backgroundTag":null,"analyzedSha":"fca799fa70ecb6ad975224271703ca43221f58de","analyzedAt":"2026-08-13T19:55:57.938Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}