{"record":{"id":"55085b6e170ffafa","repo":"SubtitleEdit/subtitleedit","slug":"unable-to-download-file-invalid-username-or-pass","errorCode":null,"errorMessage":"Unable to download file - Invalid username or password! (Perhaps file has a new location)","messagePattern":"Unable to download file - Invalid username or password! \\(Perhaps file has a new location\\)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/ui/Features/Video/SpeechToText/DownloadSpeechToTextModelsViewModel.cs","lineNumber":265,"sourceCode":"        {\n            var text = FileUtil.ReadAllTextShared(downloadFileName, Encoding.UTF8);\n            if (text.StartsWith(\"Entry not found\", StringComparison.OrdinalIgnoreCase))\n            {\n                try\n                {\n                    File.Delete(downloadFileName);\n                }\n                catch\n                {\n                    // ignore\n                }\n\n                return;\n            }\n\n            if (text.Contains(\"Invalid username or password.\"))\n            {\n                throw new Exception(\"Unable to download file - Invalid username or password! (Perhaps file has a new location)\");\n            }\n        }\n\n        var newFileName = downloadFileName.Replace(TemporaryFileExtension, string.Empty);\n\n        if (File.Exists(newFileName))\n        {\n            File.Delete(newFileName);\n        }\n\n        File.Move(downloadFileName, newFileName);\n        _downloadFileName = string.Empty;\n    }\n\n    private void Close()\n    {\n        Dispatcher.UIThread.Post(() =>\n        {","sourceCodeStart":247,"sourceCodeEnd":283,"githubUrl":"https://github.com/SubtitleEdit/subtitleedit/blob/17a9f0748781032255db3526b7215d2fb891e3af/src/ui/Features/Video/SpeechToText/DownloadSpeechToTextModelsViewModel.cs#L247-L283","documentation":"Thrown when the downloaded content of a speech-to-text model file contains the string 'Invalid username or password.' This indicates the download URL redirected to a login page or returned an HTML error page instead of the binary model, typically from a host requiring authentication.","triggerScenarios":"The model download URL points to a host (e.g. Hugging Face, GitHub release behind auth, or a private mirror) that requires login; the URL has moved and the old location returns an auth page; the download was intercepted by a captive portal or proxy auth page.","commonSituations":"The model URL was correct at time of coding but the host later added authentication; a Hugging Face gated model requiring token acceptance; a GitHub release that was made private; a corporate proxy returning its own login page; the model host changed its URL scheme.","solutions":["Open the model download URL in a browser to verify what's actually being served.","If the host requires auth (e.g. Hugging Face), generate an access token and configure it in the download service.","Find an alternative/mirror URL for the same model that doesn't require authentication.","Download the model manually in a browser and place it in the expected local models folder.","Check if the model has been relocated — search for the new download location."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Check the first bytes of the download to detect an HTML auth page\nvar firstBytes = new byte[512];\nusing var probeStream = new MemoryStream();\nawait httpClient.GetByteArrayAsync(url, ct).ContinueWith(t => { /* check content type */ });\n// Or after download:\nvar preview = Encoding.ASCII.GetString(downloadBuffer, 0, Math.Min(512, downloadBuffer.Length));\nif (preview.Contains(\"<html\") || preview.Contains(\"Invalid username\"))\n    throw new InvalidOperationException(\"Download URL returned an authentication page, not a model file.\");","typeGuard":null,"tryCatchPattern":"try { await DownloadModel(url, path, ct); }\ncatch (Exception ex) when (ex.Message.Contains(\"Invalid username or password\"))\n{ /* prompt for credentials/token, find alternative URL, or manual download */ }","preventionTips":["Verify model download URLs are publicly accessible before queuing them.","If using Hugging Face, ensure gated models have an accepted token configured.","Provide manual download instructions as a fallback when automated download hits auth.","Check the model host's URL scheme hasn't changed."],"tags":["auth","download","model","speech-to-text","credentials"],"backgroundTag":null,"analyzedSha":"17a9f0748781032255db3526b7215d2fb891e3af","analyzedAt":"2026-08-13T18:11:43.374Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}