The startProviderSession closure declared a provider?: ProviderKind parameter in its input type, but the function body never read it — it unconditionally uses the outer preferredProvider instead. Remove the dead parameter to avoid misleading future callers.