{"record":{"id":"af8d917c87bc701e","repo":"elsa-workflows/elsa-core","slug":"secret-store-name-is-not-registered","errorCode":null,"errorMessage":"Secret store '{name}' is not registered.","messagePattern":"Secret store '(.+?)' is not registered\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":404,"severity":"error","filePath":"src/modules/Elsa.Secrets/Services/SecretStoreRegistry.cs","lineNumber":14,"sourceCode":"namespace Elsa.Secrets.Services;\n\npublic class SecretStoreRegistry(IEnumerable<ISecretStore> stores) : ISecretStoreRegistry\n{\n    private readonly Lazy<Dictionary<string, ISecretStore>> _stores = new(() => stores.ToDictionary(x => x.Name, StringComparer.OrdinalIgnoreCase));\n\n    public IReadOnlyCollection<ISecretStore> List() => _stores.Value.Values.ToList();\n\n    public ISecretStore Get(string name)\n    {\n        if (TryGet(name, out var store))\n            return store!;\n\n        throw new InvalidOperationException($\"Secret store '{name}' is not registered.\");\n    }\n\n    public bool TryGet(string name, out ISecretStore? store) => _stores.Value.TryGetValue(name, out store);\n}\n","sourceCodeStart":1,"sourceCodeEnd":19,"githubUrl":"https://github.com/elsa-workflows/elsa-core/blob/fe9217bdfa0e27f0e09e45006eb6898f616e513d/src/modules/Elsa.Secrets/Services/SecretStoreRegistry.cs#L1-L19","documentation":"This error is thrown by the SecretStoreRegistry when a caller requests a secret store by name that was never registered in the registry. The registry resolves lazily-built store maps, so a lookup with TryGet misses and Get escalates to an InvalidOperationException. It indicates a configuration/registration gap rather than a runtime failure of a store itself.","triggerScenarios":"Calling ISecretStoreRegistry.Get(\"my-store\") where no provider registered a secret store with that name (typo, store registered under a different name, or the feature/DTO that registers the store was not added to DI).","commonSituations":"Typo in the store name in appsettings or code; the module that registers the store (e.g., EncryptedSecretStore or ConfigurationSecretStore) is not added to the feature list; environment-specific configuration omits the store registration.","solutions":["Verify the exact store name used in Get matches the name the store was registered with (check for typos/casing).","Ensure the feature or DI registration that adds the store to the registry (via ISecretStoreRegistry or a provider) is included in the host.","Use TryGet instead of Get when absence is an expected, handleable condition."],"exampleFix":"// before\nvar store = registry.Get(\"ProdVault\");\n// after\nif (!registry.TryGet(\"ProdVault\", out var store))\n    throw new InvalidOperationException(\"Store 'ProdVault' missing; did you register the secrets feature?\");","handlingStrategy":"type-guard","validationCode":"if (!registry.TryGet(name, out var store))\n    throw new InvalidOperationException($\"Secret store '{name}' is not registered. Registered stores: {string.Join(\", \", registry.ListNames())}\");","typeGuard":"bool HasStore(ISecretStoreRegistry registry, string name) => registry.TryGet(name, out _);","tryCatchPattern":"try\n{\n    var store = registry.Get(name);\n}\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"is not registered\"))\n{\n    logger.LogWarning(ex, \"Secret store {Name} missing; check feature registration.\", name);\n}","preventionTips":["Register all secret stores in a single feature/startup module so nothing is conditionally skipped.","Use TryGet for optional lookups.","Centralize store name strings as constants to avoid typos."],"tags":["secrets","registry","configuration"],"backgroundTag":"resource-not-found","analyzedSha":"fe9217bdfa0e27f0e09e45006eb6898f616e513d","analyzedAt":"2026-09-13T20:32:34.702Z","contentChangedAt":"2026-09-13T20:32:34.702Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}