SubtitleEdit/subtitleedit · error · FormatException
PAC code page is empty.
Error message
PAC code page is empty.
What it means
Thrown by PacCodepageParser.Parse when the `--pac-codepage` value is null/empty/whitespace. PAC (Philips SVCD caption) files are encoded using a code page; the parser needs a name (Latin, Greek, ...) or a numeric code to decode bytes, and an empty string cannot resolve to either.
Source
Thrown at src/seconv/Core/PacCodepageParser.cs:36
["Arabic"] = Pac.CodePageArabic,
["Hebrew"] = Pac.CodePageHebrew,
["Thai"] = Pac.CodePageThai,
["Cyrillic"] = Pac.CodePageCyrillic,
["ChineseTraditional"] = Pac.CodePageChineseTraditional,
["ChineseSimplified"] = Pac.CodePageChineseSimplified,
["Korean"] = Pac.CodePageKorean,
["Japanese"] = Pac.CodePageJapanese,
["LatinTurkish"] = Pac.CodePageLatinTurkish,
["Turkish"] = Pac.CodePageLatinTurkish,
["LatinPortuguese"] = Pac.CodePageLatinPortuguese,
["Portuguese"] = Pac.CodePageLatinPortuguese,
};
public static int Parse(string input)
{
if (string.IsNullOrWhiteSpace(input))
{
throw new FormatException("PAC code page is empty.");
}
var s = input.Trim();
if (Named.TryGetValue(s, out var named))
{
return named;
}
if (int.TryParse(s, NumberStyles.None, CultureInfo.InvariantCulture, out var num) &&
num >= Pac.CodePageLatin && num <= Pac.CodePageLatinPortuguese)
{
return num;
}
throw new FormatException(
$"PAC code page '{input}' is invalid. Expected a name (Latin, Greek, ...) or a number 0-12.");
}
}View on GitHub (pinned to 17a9f07487)
Solutions
- Pass a named code page, e.g. `--pac-codepage=Latin`.
- Or pass a numeric code in the valid range, e.g. `--pac-codepage=0`.
- Omit the flag if your workflow does not read PAC files.
- Guard scripts to only emit the flag when the variable is non-empty.
Example fix
# before seconv in.pac out.srt --pac-codepage= # after seconv in.pac out.srt --pac-codepage=Latin
Defensive patterns
Strategy: validation
Validate before calling
if (string.IsNullOrWhiteSpace(rawPac))
throw new ArgumentException("--pac-codepage requires a value");
var cp = PacCodepageParser.Parse(rawPac); Type guard
static bool IsPacCodepageParsable(string? s)
{
if (string.IsNullOrWhiteSpace(s)) return false;
try { PacCodepageParser.Parse(s); return true; } catch { return false; }
} Try / catch
try { var cp = PacCodepageParser.Parse(input); }
catch (FormatException ex) when (ex.Message == "PAC code page is empty.")
{
// default to Latin or abort
} Prevention
- Default to a sensible code page (e.g. Latin) when none is supplied.
- Length-check the input before parsing.
- Validate at arg-parse time for PAC inputs only.
When it happens
Trigger: Calling `PacCodepageParser.Parse(input)` with an empty string, typically because `--pac-codepage=` was passed without a value.
Common situations: Shell expansion blanking the value; wrapper script defaulting to empty; user assumes there is a default code page but PAC requires an explicit one for non-Latin content.
Related errors
- PAC code page '{input}' is invalid. Expected a name (Latin,
- Offset is empty.
- Resolution is empty.
- {StaticName} returned an unexpected response: {responseStrin
- Translate engine '{options.TranslateEngine}' is not supporte
AI-assisted analysis of SubtitleEdit/subtitleedit@17a9f07487 (2026-08-13).
Data as JSON: /api/errors/bec6fe07f6610698.
Report an issue: GitHub.