{"record":{"id":"edc27ce085b31a91","repo":"SubtitleEdit/subtitleedit","slug":"assa-style-file-not-found-assastylefile","errorCode":null,"errorMessage":"ASSA style file not found: {assaStyleFile}","messagePattern":"ASSA style file not found: (.+?)","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"src/seconv/Core/LibSEIntegration.cs","lineNumber":896,"sourceCode":"            }\n            return;\n        }\n\n        if (string.IsNullOrEmpty(subtitle.Header) || !subtitle.Header.Contains(\"[V4+ Styles]\"))\n        {\n            subtitle.Header = AdvancedSubStationAlpha.DefaultHeader;\n        }\n\n        if (resolution is { } r)\n        {\n            subtitle.Header = AdvancedSubStationAlpha.SetResolution(subtitle.Header, r.Width, r.Height);\n        }\n\n        if (!string.IsNullOrEmpty(assaStyleFile))\n        {\n            if (!File.Exists(assaStyleFile))\n            {\n                throw new FileNotFoundException($\"ASSA style file not found: {assaStyleFile}\", assaStyleFile);\n            }\n            var styleSubtitle = new Subtitle();\n            var styleLines = new List<string>(File.ReadAllLines(assaStyleFile));\n            new AdvancedSubStationAlpha().LoadSubtitle(styleSubtitle, styleLines, assaStyleFile);\n            var styles = AdvancedSubStationAlpha.GetSsaStylesFromHeader(styleSubtitle.Header);\n            foreach (var style in styles)\n            {\n                subtitle.Header = AdvancedSubStationAlpha.UpdateOrAddStyle(subtitle.Header, style);\n            }\n        }\n    }\n\n    public static void DeleteContains(Subtitle subtitle, string deleteContains)\n    {\n        if (string.IsNullOrEmpty(deleteContains))\n        {\n            return;\n        }","sourceCodeStart":878,"sourceCodeEnd":914,"githubUrl":"https://github.com/SubtitleEdit/subtitleedit/blob/17a9f0748781032255db3526b7215d2fb891e3af/src/seconv/Core/LibSEIntegration.cs#L878-L914","documentation":"Thrown when an ASSA (Advanced SubStation Alpha) style override file was specified via assaStyleFile but that file does not exist (File.Exists returns false). The style file provides V4+ Styles that are merged into the subtitle's header via AdvancedSubStationAlpha.UpdateOrAddStyle. When specified it must be loadable; otherwise FileNotFoundException fires with the path as FileName.","triggerScenarios":"Calling the ASSA setup/save path with a non-null, non-empty assaStyleFile that does not point to an existing file. The file is loaded as ASS/SSA text and its styles are extracted — if the file is missing the load cannot proceed.","commonSituations":"CLI --assa-style referencing a style file that was moved or never committed to the repo; a shared config pointing to a developer-local path; a typo in the style file name.","solutions":["Verify the style file path with File.Exists before calling; if styles are optional, omit the argument when the file is absent.","Ensure the style file is a valid ASS/SSA file with a [V4+ Styles] section — open it in the SE GUI to validate.","Resolve to an absolute path with Path.GetFullPath to avoid working-directory issues."],"exampleFix":"// before\nLibSEIntegration.ApplyAssaOptions(sub, resolution: r, assaStyleFile: stylePath);\n\n// after\nif (!string.IsNullOrEmpty(stylePath) && !File.Exists(stylePath))\n    throw new FileNotFoundException($\"ASSA style file not found: {stylePath}\");\nLibSEIntegration.ApplyAssaOptions(sub, resolution: r, assaStyleFile: stylePath);","handlingStrategy":"validation","validationCode":"if (!string.IsNullOrEmpty(assaStyleFile) && !File.Exists(assaStyleFile))\n    throw new FileNotFoundException($\"ASSA style file not found: {assaStyleFile}\", assaStyleFile);","typeGuard":"static bool IsAssaStyleReadable(string path) => string.IsNullOrEmpty(path) || File.Exists(path);","tryCatchPattern":"try { LibSEIntegration.ApplyAssaOptions(sub, resolution: r, assaStyleFile: stylePath); }\ncatch (FileNotFoundException ex) when (ex.Message.Contains(\"ASSA style file not found\"))\n{ /* omit style override or supply correct path */ }","preventionTips":["Treat the ASSA style file as optional — omit when not needed.","Validate File.Exists for optional style override paths.","Use absolute paths for style files to avoid CWD issues in batch jobs."],"tags":["file-not-found","assa","validation","path","subtitles"],"backgroundTag":null,"analyzedSha":"17a9f0748781032255db3526b7215d2fb891e3af","analyzedAt":"2026-08-13T18:11:43.374Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}