{"record":{"id":"e50defb036f55674","repo":"SubtitleEdit/subtitleedit","slug":"indextts-crispasr-model-filename-failed-integr","errorCode":null,"errorMessage":"IndexTTS (CrispASR) model {fileName} failed integrity check (expected SHA-256 {expected}, got {actual}).","messagePattern":"IndexTTS \\(CrispASR\\) model (.+?) failed integrity check \\(expected SHA-256 (.+?), got (.+?)\\)\\.","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"src/ui/Logic/Download/IndexTtsCrispAsrDownloadService.cs","lineNumber":143,"sourceCode":"        {\n            return;\n        }\n\n        var expected = DownloadHashManager.GetLatestKnownHash(key);\n        if (string.IsNullOrEmpty(expected))\n        {\n            return;\n        }\n\n        string actual;\n        await using (var stream = File.OpenRead(filePath))\n        {\n            actual = await Sha256Util.ComputeSha256Async(stream, cancellationToken);\n        }\n\n        if (!string.Equals(expected, actual, StringComparison.OrdinalIgnoreCase))\n        {\n            throw new IOException(\n                $\"IndexTTS (CrispASR) model {fileName} failed integrity check (expected SHA-256 {expected}, got {actual}).\");\n        }\n    }\n\n    private static string GetUrl(string fileName)\n    {\n        if (!ModelUrls.TryGetValue(fileName, out var url))\n        {\n            throw new ArgumentException($\"Unknown IndexTTS (CrispASR) model: {fileName}\", nameof(fileName));\n        }\n        return url;\n    }\n\n    private static void TryDelete(string path)\n    {\n        try { File.Delete(path); } catch { /* best-effort cleanup */ }\n    }\n","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/SubtitleEdit/subtitleedit/blob/17a9f0748781032255db3526b7215d2fb891e3af/src/ui/Logic/Download/IndexTtsCrispAsrDownloadService.cs#L125-L161","documentation":"Thrown by the IndexTTS CrispASR integrity check: the SHA-256 of the file at filePath does not case-insensitively match the expected hash registered for that fileName. IOException is used so the pipeline treats it as an I/O-layer fault (retryable). A mismatch signals corruption, truncation, tampering, or a stale expected hash.","triggerScenarios":"Downloaded bytes for fileName hash to something other than expected; a partial/corrupt file is cached at filePath; the mirror served a different artifact; the expected-hash registry was bumped for a new model but old bytes remain on disk; concurrent file modification during hashing.","commonSituations":"Old cache from a prior app version after a model update; CDN served a corrupt/stale artifact; AV altered the file; user replaced the file with a same-named different model.","solutions":["Delete the cached file at filePath and re-download.","Verify the expected hash matches the current upstream artifact for fileName; update the registry if a new release shipped.","Re-download from a clean network / alternate mirror to rule out in-transit corruption.","Ensure no AV/sync process touches the file during the hash computation."],"exampleFix":"// before\nawait indexTtsService.DownloadAsync(fileName, path, progress, ct);\n\n// after\nif (File.Exists(path)) File.Delete(path);\nawait indexTtsService.DownloadAsync(fileName, path, progress, ct);","handlingStrategy":"try-catch","validationCode":"if (!File.Exists(filePath)) { /* allow download */ }","typeGuard":null,"tryCatchPattern":"try { await indexTtsService.VerifyAsync(fileName, filePath, expected, ct); }\ncatch (IOException ex) when (ex.Message.Contains(\"failed integrity check\"))\n{ File.Delete(filePath); await indexTtsService.DownloadAsync(fileName, filePath, progress, ct); }","preventionTips":["Purge cached IndexTTS models after a version bump.","Log actual vs expected SHA-256 on mismatch.","Keep the expected-hash registry and the model URL bumped together."],"tags":["integrity","sha256","indextts","crispasr","download","corruption"],"backgroundTag":null,"analyzedSha":"17a9f0748781032255db3526b7215d2fb891e3af","analyzedAt":"2026-08-13T18:11:43.374Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}