{"record":{"id":"9f9b566c5956ad20","repo":"elsa-workflows/elsa-core","slug":"the-unlinked-identity-policy-selection-type-is-not-available","errorCode":null,"errorMessage":"The unlinked identity policy '{selection.Type}' is not available.","messagePattern":"The unlinked identity policy '(.+?)' is not available\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/modules/Elsa.ExternalAuthentication/Services/DefaultExternalIdentityResolver.cs","lineNumber":32,"sourceCode":"    IOptions<ExternalAuthenticationOptions> options) : IExternalIdentityResolver, IExternalIdentitySignInTracker\n{\n    private readonly IReadOnlyDictionary<string, IUnlinkedIdentityPolicy> _policies = policies.ToDictionary(x => x.Type, StringComparer.Ordinal);\n\n    public async ValueTask<ExternalIdentityResolution> ResolveAsync(ExternalIdentityResolutionContext context, CancellationToken cancellationToken = default)\n    {\n        ArgumentNullException.ThrowIfNull(context);\n\n        var connectionKey = ConnectionRevisionCalculator.NormalizeKey(context.Connection.Connection.Key);\n        var existingLink = await provisioner.FindLinkAsync(context.TargetTenantId, connectionKey, context.Identity, cancellationToken);\n        if (existingLink is not null)\n        {\n            ValidateLink(existingLink, context);\n            return new(existingLink.UserId, false);\n        }\n\n        var selection = GetPolicySelection(context.Connection);\n        var policy = _policies.GetValueOrDefault(selection.Type)\n            ?? throw new InvalidOperationException($\"The unlinked identity policy '{selection.Type}' is not available.\");\n        var decision = await policy.EvaluateAsync(new(\n            context.TargetTenantId,\n            context.Connection,\n            context.Identity,\n            context.ProjectedClaims,\n            selection.Settings), cancellationToken);\n\n        var result = decision switch\n        {\n            UnlinkedIdentityDecision.Reject reject => throw new ExternalIdentityUnlinkedException(reject.SafeReason),\n            UnlinkedIdentityDecision.CreateUser createUser => await provisioner.CreateLinkOrGetExistingAsync(\n                new(context.TargetTenantId, connectionKey, context.Identity, createUser.Proposal), cancellationToken),\n            UnlinkedIdentityDecision.LinkExistingUser linkExistingUser => await provisioner.CreateLinkOrGetExistingAsync(\n                new(context.TargetTenantId, connectionKey, context.Identity, null, linkExistingUser.UserId), cancellationToken),\n            _ => throw new InvalidOperationException(\"The unlinked identity policy returned an unsupported decision.\")\n        };\n\n        ValidateLink(result.Link, context);","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/elsa-workflows/elsa-core/blob/fe9217bdfa0e27f0e09e45006eb6898f616e513d/src/modules/Elsa.ExternalAuthentication/Services/DefaultExternalIdentityResolver.cs#L14-L50","documentation":"Thrown by DefaultExternalIdentityResolver.ResolveAsync when the connection's configured unlinked-identity policy selection references a policy Type that is not present in the dictionary of IUnlinkedIdentityPolicy implementations resolved from DI. It is a configuration guard: the connection was set up with a policy type no registered provider implements.","triggerScenarios":"Thrown at src/modules/Elsa.ExternalAuthentication/Services/DefaultExternalIdentityResolver.cs:32 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Register the missing IUnlinkedIdentityPolicy implementation (matching selection.Type) in the DI container.","Update the connection configuration to select a policy type that is registered.","Check for typos or casing mismatches between the configured policy type string and the registered policy's Type value."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}