{"record":{"id":"3cf9010ca51c3c5d","repo":"duplicati/duplicati","slug":"meganopassword","errorCode":"MegaNoPassword","errorMessage":"No password given","messagePattern":"No password given","errorType":"exception","errorClass":"UserInformationException","httpStatus":null,"severity":"error","filePath":"Duplicati/Library/Backend/Mega/MegaBackend.cs","lineNumber":85,"sourceCode":"                    }\r\n                    return cl;\r\n                }).ConfigureAwait(false);\r\n\r\n            return m_client;\r\n        }\r\n\r\n        public MegaBackend(string url, Dictionary<string, string?> options)\r\n        {\r\n            var uri = new Utility.RelaxedUri(url);\r\n\r\n            var auth = AuthOptionsHelper.Parse(options, uri.Username, uri.Password);\r\n            if (options.ContainsKey(\"auth-two-factor-key\"))\r\n                m_twoFactorKey = options[\"auth-two-factor-key\"];\r\n\r\n            if (string.IsNullOrWhiteSpace(auth.Username))\r\n                throw new UserInformationException(Strings.MegaBackend.NoUsernameError, \"MegaNoUsername\");\r\n            if (string.IsNullOrWhiteSpace(auth.Password))\r\n                throw new UserInformationException(Strings.MegaBackend.NoPasswordError, \"MegaNoPassword\");\r\n\r\n            (m_username, m_password) = auth.GetCredentials();\r\n            m_prefix = uri.HostAndPath ?? \"\";\r\n            m_timeouts = TimeoutOptionsHelper.Parse(options);\r\n        }\r\n\r\n        private async Task<INode> FetchCurrentFolderAsync(bool autocreate, CancellationToken cancelToken)\r\n        {\r\n            var client = await GetClient(cancelToken).ConfigureAwait(false);\r\n            var parts = m_prefix.Split(new string[] { \"/\" }, StringSplitOptions.RemoveEmptyEntries);\r\n            var nodes = await Utility.Utility.WithTimeout(m_timeouts.ListTimeout, cancelToken, _ => client.GetNodes()).ConfigureAwait(false);\r\n            INode parent = nodes.First(x => x.Type == NodeType.Root);\r\n\r\n            foreach (var n in parts)\r\n            {\r\n                var item = nodes.FirstOrDefault(x => x.Name == n && x.Type == NodeType.Directory && x.ParentId == parent.Id);\r\n                if (item == null)\r\n                {\r","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/duplicati/duplicati/blob/3f348be3e33f5d72d414e3ad55839c2ba34dda67/Duplicati/Library/Backend/Mega/MegaBackend.cs#L67-L103","documentation":"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.","triggerScenarios":"The mega:// URL has a username but no password segment, and no `auth-password` option is provided, leaving auth.Password empty.","commonSituations":"URL `mega://user@folder` with the password omitted; password supplied via a misnamed option; password accidentally stripped during config export/import.","solutions":["Include the password in the URL (mega://user:pass@host/path) or pass --auth-password=<value>.","Verify the option name is exactly auth-password.","Re-enter credentials through the Duplicati UI to avoid URL-encoding pitfalls for special characters."],"exampleFix":"// before\nmega://user@example.com@backup-folder\n// after\nmega://user@example.com:secret@backup-folder\n// or\n--auth-password=secret","handlingStrategy":"validation","validationCode":"var auth = AuthOptionsHelper.Parse(options, uri.Username, uri.Password);\nif (string.IsNullOrWhiteSpace(auth.Password))\n    throw new InvalidOperationException(\"Mega requires a password (auth-password or mega://user:pass@...).\");","typeGuard":"static bool HasMegaPassword(AuthOptionsHelper.AuthOptions? a) => !string.IsNullOrWhiteSpace(a?.Password);","tryCatchPattern":"try { var backend = new MegaBackend(url, options); }\ncatch (UserInformationException ex) when (ex.HelpID == \"MegaNoPassword\")\n{ /* prompt for password and retry */ }","preventionTips":["Always supply auth-password (or embed it in the mega:// URL).","URL-encode special characters when placing the password in the URL.","Re-enter credentials through the UI after any config export/import."],"tags":["mega","config","auth","credentials"],"backgroundTag":null,"analyzedSha":"3f348be3e33f5d72d414e3ad55839c2ba34dda67","analyzedAt":"2026-08-13T16:48:27.008Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}