SubtitleEdit/subtitleedit · error · FileNotFoundException

ASSA style file not found: {assaStyleFile}

Error message

ASSA style file not found: {assaStyleFile}

What it means

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.

Source

Thrown at src/seconv/Core/LibSEIntegration.cs:896

            }
            return;
        }

        if (string.IsNullOrEmpty(subtitle.Header) || !subtitle.Header.Contains("[V4+ Styles]"))
        {
            subtitle.Header = AdvancedSubStationAlpha.DefaultHeader;
        }

        if (resolution is { } r)
        {
            subtitle.Header = AdvancedSubStationAlpha.SetResolution(subtitle.Header, r.Width, r.Height);
        }

        if (!string.IsNullOrEmpty(assaStyleFile))
        {
            if (!File.Exists(assaStyleFile))
            {
                throw new FileNotFoundException($"ASSA style file not found: {assaStyleFile}", assaStyleFile);
            }
            var styleSubtitle = new Subtitle();
            var styleLines = new List<string>(File.ReadAllLines(assaStyleFile));
            new AdvancedSubStationAlpha().LoadSubtitle(styleSubtitle, styleLines, assaStyleFile);
            var styles = AdvancedSubStationAlpha.GetSsaStylesFromHeader(styleSubtitle.Header);
            foreach (var style in styles)
            {
                subtitle.Header = AdvancedSubStationAlpha.UpdateOrAddStyle(subtitle.Header, style);
            }
        }
    }

    public static void DeleteContains(Subtitle subtitle, string deleteContains)
    {
        if (string.IsNullOrEmpty(deleteContains))
        {
            return;
        }

View on GitHub (pinned to 17a9f07487)

Solutions

  1. Verify the style file path with File.Exists before calling; if styles are optional, omit the argument when the file is absent.
  2. Ensure the style file is a valid ASS/SSA file with a [V4+ Styles] section — open it in the SE GUI to validate.
  3. Resolve to an absolute path with Path.GetFullPath to avoid working-directory issues.

Example fix

// before
LibSEIntegration.ApplyAssaOptions(sub, resolution: r, assaStyleFile: stylePath);

// after
if (!string.IsNullOrEmpty(stylePath) && !File.Exists(stylePath))
    throw new FileNotFoundException($"ASSA style file not found: {stylePath}");
LibSEIntegration.ApplyAssaOptions(sub, resolution: r, assaStyleFile: stylePath);
Defensive patterns

Strategy: validation

Validate before calling

if (!string.IsNullOrEmpty(assaStyleFile) && !File.Exists(assaStyleFile))
    throw new FileNotFoundException($"ASSA style file not found: {assaStyleFile}", assaStyleFile);

Type guard

static bool IsAssaStyleReadable(string path) => string.IsNullOrEmpty(path) || File.Exists(path);

Try / catch

try { LibSEIntegration.ApplyAssaOptions(sub, resolution: r, assaStyleFile: stylePath); }
catch (FileNotFoundException ex) when (ex.Message.Contains("ASSA style file not found"))
{ /* omit style override or supply correct path */ }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of SubtitleEdit/subtitleedit@17a9f07487 (2026-08-13). Data as JSON: /api/errors/edc27ce085b31a91. Report an issue: GitHub.