{"record":{"id":"34760d44e1c7d75b","repo":"elsa-workflows/elsa-core","slug":"secret-type-name-is-not-registered","errorCode":null,"errorMessage":"Secret type '{name}' is not registered.","messagePattern":"Secret type '(.+?)' is not registered\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":404,"severity":"error","filePath":"src/modules/Elsa.Secrets/Services/SecretTypeRegistry.cs","lineNumber":14,"sourceCode":"namespace Elsa.Secrets.Services;\n\npublic class SecretTypeRegistry(IEnumerable<ISecretTypeProvider> providers) : ISecretTypeRegistry\n{\n    private readonly Lazy<Dictionary<string, ISecretTypeProvider>> _providers = new(() => providers.ToDictionary(x => x.Descriptor.Name, StringComparer.OrdinalIgnoreCase));\n\n    public IReadOnlyCollection<SecretTypeDescriptor> List() => _providers.Value.Values.Select(x => x.Descriptor).ToList();\n\n    public ISecretTypeProvider Get(string name)\n    {\n        if (TryGet(name, out var provider))\n            return provider!;\n\n        throw new InvalidOperationException($\"Secret type '{name}' is not registered.\");\n    }\n\n    public bool TryGet(string name, out ISecretTypeProvider? provider) => _providers.Value.TryGetValue(name, out provider);\n}\n","sourceCodeStart":1,"sourceCodeEnd":19,"githubUrl":"https://github.com/elsa-workflows/elsa-core/blob/fe9217bdfa0e27f0e09e45006eb6898f616e513d/src/modules/Elsa.Secrets/Services/SecretTypeRegistry.cs#L1-L19","documentation":"This error is thrown by the SecretTypeRegistry when a secret type name has no registered ISecretTypeProvider. The registry lazily builds a name-to-provider map; Get escalates a TryGet miss into an InvalidOperationException. It signals that the secret type descriptor/provider was never registered in DI.","triggerScenarios":"Calling ISecretTypeRegistry.Get(\"connection-string\") (or similar) where no ISecretTypeProvider for that name was registered, typically because a provider class was not registered via a feature or DI extension.","commonSituations":"Adding a custom secret type but forgetting to register its provider; renaming a provider's advertised name; running a host with a trimmed feature set that excludes the module registering the provider.","solutions":["Confirm the provider for that secret type name is registered in DI/feature configuration.","Check the name string matches exactly what the provider advertises (typos, casing).","Use TryGet when a missing type is an expected condition and handle it gracefully."],"exampleFix":"// before\nvar provider = secretTypes.Get(\"ApiKey\");\n// after\nif (!secretTypes.TryGet(\"ApiKey\", out var provider))\n    throw new InvalidOperationException(\"Secret type 'ApiKey' has no registered provider.\");","handlingStrategy":"type-guard","validationCode":"if (!secretTypes.TryGet(typeName, out var provider))\n    throw new InvalidOperationException($\"Secret type '{typeName}' has no registered provider.\");","typeGuard":"bool HasSecretType(ISecretTypeRegistry registry, string name) => registry.TryGet(name, out _);","tryCatchPattern":"try\n{\n    var provider = secretTypes.Get(typeName);\n}\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"Secret type\"))\n{\n    logger.LogWarning(\"Unknown secret type {Type}; verify provider registration.\", typeName);\n}","preventionTips":["Register every custom ISecretTypeProvider in a feature module.","Keep type names in constants shared by provider and consumers.","Prefer TryGet when absence is expected."],"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"}