duplicati/duplicati · error · UserInformationException

MegaNoPassword

MegaNoPassword

Error message

No password given

What it means

Thrown in the MegaBackend constructor when AuthOptionsHelper yields a null/whitespace password. Symmetric to the username check, Mega mandates a password, so construction fails before any network call.

Source

Thrown at Duplicati/Library/Backend/Mega/MegaBackend.cs:85

                    }
                    return cl;
                }).ConfigureAwait(false);

            return m_client;
        }

        public MegaBackend(string url, Dictionary<string, string?> options)
        {
            var uri = new Utility.RelaxedUri(url);

            var auth = AuthOptionsHelper.Parse(options, uri.Username, uri.Password);
            if (options.ContainsKey("auth-two-factor-key"))
                m_twoFactorKey = options["auth-two-factor-key"];

            if (string.IsNullOrWhiteSpace(auth.Username))
                throw new UserInformationException(Strings.MegaBackend.NoUsernameError, "MegaNoUsername");
            if (string.IsNullOrWhiteSpace(auth.Password))
                throw new UserInformationException(Strings.MegaBackend.NoPasswordError, "MegaNoPassword");

            (m_username, m_password) = auth.GetCredentials();
            m_prefix = uri.HostAndPath ?? "";
            m_timeouts = TimeoutOptionsHelper.Parse(options);
        }

        private async Task<INode> FetchCurrentFolderAsync(bool autocreate, CancellationToken cancelToken)
        {
            var client = await GetClient(cancelToken).ConfigureAwait(false);
            var parts = m_prefix.Split(new string[] { "/" }, StringSplitOptions.RemoveEmptyEntries);
            var nodes = await Utility.Utility.WithTimeout(m_timeouts.ListTimeout, cancelToken, _ => client.GetNodes()).ConfigureAwait(false);
            INode parent = nodes.First(x => x.Type == NodeType.Root);

            foreach (var n in parts)
            {
                var item = nodes.FirstOrDefault(x => x.Name == n && x.Type == NodeType.Directory && x.ParentId == parent.Id);
                if (item == null)
                {

View on GitHub (pinned to 3f348be3e3)

Solutions

  1. Include the password in the URL (mega://user:pass@host/path) or pass --auth-password=<value>.
  2. Verify the option name is exactly auth-password.
  3. Re-enter credentials through the Duplicati UI to avoid URL-encoding pitfalls for special characters.

Example fix

// before
mega://user@example.com@backup-folder
// after
mega://user@example.com:secret@backup-folder
// or
--auth-password=secret
Defensive patterns

Strategy: validation

Validate before calling

var auth = AuthOptionsHelper.Parse(options, uri.Username, uri.Password);
if (string.IsNullOrWhiteSpace(auth.Password))
    throw new InvalidOperationException("Mega requires a password (auth-password or mega://user:pass@...).");

Type guard

static bool HasMegaPassword(AuthOptionsHelper.AuthOptions? a) => !string.IsNullOrWhiteSpace(a?.Password);

Try / catch

try { var backend = new MegaBackend(url, options); }
catch (UserInformationException ex) when (ex.HelpID == "MegaNoPassword")
{ /* prompt for password and retry */ }

Prevention

When it happens

Trigger: The mega:// URL has a username but no password segment, and no `auth-password` option is provided, leaving auth.Password empty.

Common situations: URL `mega://user@folder` with the password omitted; password supplied via a misnamed option; password accidentally stripped during config export/import.

Related errors


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