duplicati/duplicati · error · InvalidOperationException

No default secret provider is available for this system

Error message

No default secret provider is available for this system

What it means

Thrown by SecretProviderLoader.CreateInstanceAsync when config is 'default://' and GetDefaultSecretProviderForOperatingSystem returns null. The default provider is platform-specific: Windows uses WindowsCredentialManagerProvider, macOS uses MacOSKeyChainProvider, and Linux uses LibSecretLinuxProvider only when IsSupported returns true (i.e. a DBus secret service such as gnome-keyring or kwallet is available). On Linux without such a service, or on an unsupported OS, the method returns null.

Source

Thrown at Duplicati/Library/DynamicLoader/SecretProviderLoader.cs:154

        else if (config.StartsWith("%") && config.EndsWith("%"))
        {
            envName = config[1..^1];
        }

        if (envName != null)
        {
            var result = Environment.GetEnvironmentVariable(envName.ToUpperInvariant());
            if (string.IsNullOrEmpty(result))
                throw new ArgumentException($"The environment variable {envName} was not found");

            config = result;
        }

        if (string.Equals(config, "default://", StringComparison.OrdinalIgnoreCase))
        {
            var defaultProvider = await GetDefaultSecretProviderForOperatingSystem(initialize, cancellationToken).ConfigureAwait(false);
            if (defaultProvider == null)
                throw new InvalidOperationException("No default secret provider is available for this system");

            return defaultProvider;
        }

        var uri = new Uri(config);
        var key = uri.Scheme;

        var providerType = Modules.FirstOrDefault(p => p.Key == key)
            ?? throw new ArgumentException($"No secret provider found for key {key}");

        if (Activator.CreateInstance(providerType.GetType()) is not ISecretProvider provider)
            throw new InvalidOperationException($"Failed to create an instance of {providerType}");

        if (initialize)
            await provider.InitializeAsync(uri, cancellationToken).ConfigureAwait(false);

        return provider;
    }

View on GitHub (pinned to 3f348be3e3)

Solutions

  1. Install and start a secret service (gnome-keyring with ssh prompting, or kwallet) and ensure the process can talk to DBus.
  2. Specify an explicit provider config (e.g. 'prompt://', a file-based provider) instead of relying on 'default://'.
  3. For containers, prefer passing the secret via environment variable indirection that resolves to an explicit, always-available provider.

Example fix

// before
var p = await SecretProviderLoader.CreateInstanceAsync("default://", true, ct);

// after
var p = await SecretProviderLoader.CreateInstanceAsync("default://", true, ct);
// catch InvalidOperationException and fall back:
//   var p = await SecretProviderLoader.CreateInstanceAsync("prompt://", true, ct);
Defensive patterns

Strategy: fallback

Validate before calling

// No direct pre-check; guard via the OS support probe the provider itself exposes.
if (OperatingSystem.IsLinux())
{
    var probe = new Duplicati.Library.SecretProvider.LibSecretLinuxProvider();
    if (!await probe.IsSupported(ct).ConfigureAwait(false))
        // do not use 'default://' here
        config = "prompt://";
}

Type guard

null

Try / catch

try { p = await SecretProviderLoader.CreateInstanceAsync("default://", true, ct); }
catch (InvalidOperationException ex) when (ex.Message.Contains("No default secret provider"))
{
    logger.LogWarning("No OS secret store; falling back to an explicit provider.");
    p = await SecretProviderLoader.CreateInstanceAsync("prompt://", true, ct);
}

Prevention

When it happens

Trigger: Using the 'default://' config on a Linux host with no running secret service daemon, or on an OS none of the platform branches match.

Common situations: Headless Linux servers / containers without gnome-keyring or kwallet; CI runners with no DBus secret service; minimal Alpine images lacking the libsecret native libraries.

Related errors


AI-assisted analysis of duplicati/duplicati@3f348be3e3 (2026-08-13). Data as JSON: /api/errors/61b08012fc411d85. Report an issue: GitHub.